KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In Ruby, is there a way to redefine a method of a particular instance of a class using a proc? For example: class Foo def bar() return "hello" end end x = Foo.new y = Foo.new (Something like): y.method(:bar) = lambda { return "goodbye" } x.bar y.bar Producing: hello goodbye Thanks.
Tags (comma-separated)
Save Edits
Cancel