Last active
December 16, 2015 16:58
-
-
Save pmyjavec/5466564 to your computer and use it in GitHub Desktop.
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
### Problem, rigid dependency injection ### | |
class Demo | |
def initialize | |
@instancev = Something.new | |
end | |
def method_1 | |
do_that | |
@instancev.something | |
end | |
def method_2 | |
filter_something | |
@instancev.orother | |
end | |
end | |
### Solution ### | |
class Demo | |
def something | |
Something | |
end | |
def will_use_something | |
s = something.new | |
s.awesome_stuff | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment