Build Status Code Climate Test Coverage Inline docs

Strudel is a dependency injection container for Ruby. It's a way to organize your Ruby application to take advantage of the dependency inversion principle.

Why another DI framework?

Strudel is not a framework. It's one class that serves as a container only. No auto-injection. That means no polluting your classes with garbage injection metaprogramming. You have full, explicit control over how your services are constructed.

Honestly, you may not even need Strudel or any other DI library. If you are passing your dependencies through your class constructors, you're already doing dependency injection! Strudel simply helps you organize your services and dependencies in one place.

But Ruby Doesn't Need Dependency Injection!

You may have read this post by David Heineimer Hansson. However he didn't address the primary benefit of DI, explicitly defining dependencies. I also happen to think that patching code at runtime for testing is a egregious anti-pattern. In case you need more convincing, check out this [great post] by Piotr Solnica.


Add this line to your application's Gemfile:

gem 'strudel'

Getting Started



Strudel is a port of the JavaScript library papaya by Justin Howard.

Papaya is originally inspired by Pimple, a library for PHP by Fabien Potencier.


The gem is available as open source under the terms of the MIT License.