Created
April 4, 2014 03:55
-
-
Save jwoertink/9967795 to your computer and use it in GitHub Desktop.
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
| # Looking to write an API like this. | |
| # Before calling Something::Thing#search, there has to be an instance of Something::Connection | |
| # There are other classes to be used that require the connection instance as well. | |
| conn = Something::Connection.new | |
| things = Something::Thing.search('stuff') # requires that an instance of Something::Connection exists | |
| other = Something::Other.stuff('more') # also requires that instance exists | |
| conn.close | |
| # How can I save that instance in such a way that any other classes in that module will see that, | |
| # without passing that variable every single time? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
whoa, thanks @alexpeachey
I hope this is right