Created
January 25, 2011 02:30
-
-
Save usergenic/794408 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
| module Name | |
| def client | |
| ApiClient.new | |
| end | |
| # this puts the instance method 'client' on Name. | |
| # otherwise you should have said def self.client | |
| extend self | |
| class Product | |
| def get_something | |
| # this is an insane but general way to do this. | |
| client = Module.nesting[-1].client | |
| # or just do it like this | |
| client = Name.client | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment