Project

dichotomy

0.0
No commit activity in last 3 years
No release in over 3 years
Dichotomy provides architectural plumbing that allows you to create and manage application components, and acts as the Application Composition layer.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
~> 0.9

Runtime

>= 2.1.9, ~> 2.1
 Project Readme

Dichotomy

Dichotomy is an Inversion of Control Container for Ruby applications.

Dichotomy provides architectural plumbing that allows you to create and manage application components, and acts as the Application Composition layer.

The vision

An ioc container should "fuzzy" match dependencies to inject based on what members and method calls are used on the dependencies of a function.

Other implementations

@torgeir provided the first implementation and did it in JavaScript.

The project can be found here: fuzzyioc

Features

Dichotomy provides:

  • Dependency injection by "fuzzy" matching classes
  • Enables you to create container extensions that add functionality to the container.

Installation

Add this line to your application's Gemfile:

gem 'dichotomy'

And then execute:

$ bundle

Or install it yourself as:

$ gem install dichotomy

Usage

require 'dichotomy'
require 'example_dependency'
require 'example_dependency_two'

dichotomy_container = Dichotomy::Container.new

example_dependency_subject = dichotomy_container.register_type(ExampleDependency)
example_dependency_subject_two = dichotomy_container.register_type(ExampleDependencyTwo)

dichotomy_container.resolve_type(example_dependency_subject_two)

Contributing

  1. Fork it ( https://github.com/rinoandrejohnsen/dichotomy/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request