THIS GEM IS NO LONGER BEING MAINTAINED
Alternate version here (Under the same name) with cleaner api to meta-methods
MetaInstance
A few helpers for manipulating methods on an instance of an object.
In your Gemfile
gem 'meta_instance'
Usage
With a class:
class Foo
include MetaInstance
def bar; "bar"; end
end
You can do this:
f = Foo.new
f.bar
# => "bar"
f.instance_define(:bar){ "foo" }
f.bar
# => "foo"
Foo.new.bar
# => "bar"
See Specs for examples :-)