Simple Dependency Injection framework for Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.


Dependo is a very simple Dependency Injection framework for Ruby. Some say you don't need dependency injection when you're using Ruby. Maybe they're right, but I've come across some places where I need it.

For example, in my apps using Sinatra and Sequel, I need to be able to log, using a single Logger instance, from both my Sinatra app and from within my Sequel models. I'm not about to pass that Logger around as a parameter anywhere, and I don't want to instantiate it in every class that needs to log.

So, injecting the Logger is the easiest, best solution.


Dependo doesn't depend on anything. In test, it relies on rspec and either rcov (Ruby 1.8) or simplecov (Ruby 1.9).

Install the gem: gem install dependo-(version).gem

Running the tests:

rake spec

Building the gem:

rake gem:build

Install gem with Rake:

rake gem:install



Dependo::Registry[:log] =


This makes it easy to use your injected dependencies as instance methods:

class MyThing
    include Dependo::Mixin

thing = "I'm logging!"


This makes it easy to use your injected dependencies as class methods:

class MyThing
    extend Dependo::Mixin
end "I'm logging!"


See the LICENSE file. Licensed under the Apache 2.0 License