Skip to content

Instantly share code, notes, and snippets.

@usergenic
Created January 25, 2011 02:30
Show Gist options
  • Select an option

  • Save usergenic/794408 to your computer and use it in GitHub Desktop.

Select an option

Save usergenic/794408 to your computer and use it in GitHub Desktop.
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