Skip to content

Instantly share code, notes, and snippets.

@zeisler
Last active August 29, 2015 14:17
Show Gist options
  • Save zeisler/58ee98c4a35c2f546b60 to your computer and use it in GitHub Desktop.
Save zeisler/58ee98c4a35c2f546b60 to your computer and use it in GitHub Desktop.
class Sharer
def initalizer(stuff_name)
@stuff_name = stuff_name
end
def stuff
@stuff_name
end
end
class Thing
def initalizer(*args)
@sharer = Sharer.new(*args)
end
def method_missing(meth, *args, &block)
@sharer.send(method, *args, &block)
end
def responds_to_missing(meth)
@sharer.responds_to(meth)
end
end
thing = Thing.new('my stuff')
puts thing.stuff
=> 'my stuff'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment