Skip to content

Instantly share code, notes, and snippets.

@danbernier
Created April 16, 2013 18:58
Show Gist options
  • Save danbernier/5398582 to your computer and use it in GitHub Desktop.
Save danbernier/5398582 to your computer and use it in GitHub Desktop.
DI
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