Created
January 22, 2015 21:31
-
-
Save blaix/5a6a199beab5de8b8ab9 to your computer and use it in GitHub Desktop.
DI container in ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Factory | |
def foo(**kwargs) | |
kwargs[:bar] ||= bar | |
Foo.new(**kwargs) | |
end | |
def bar(**kwargs) | |
kwargs[:baz] ||= baz | |
Bar.new(**kwargs) | |
end | |
def baz | |
Baz.new | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment