Created
April 16, 2013 18:58
-
-
Save danbernier/5398582 to your computer and use it in GitHub Desktop.
DI
This file contains 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 HasDependents | |
def initialize(dependent_class=Kid) | |
@dependent = dependent_class.new | |
@dependent.parent = self | |
end | |
end | |
class Kid | |
attr_writer :parent | |
end | |
class TestKid | |
attr_writer :parent | |
end | |
HasDependents.new | |
HasDependents.new(FakeKid) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment