0

I want to open a class, and redefine an instance method, using the original implementation.

# Original class
class Test
  def my_method
    # do something
  end
end

# Monkey patched version
class Test
  def my_method
    wrap_my_method do
       # call a copy of original my_method?
    end
  end
end

With class methods I would copy the method into a proc, and then call it. How can I do something similar with instance methods?

Matilda Smeds
  • 1,384
  • 11
  • 18

0 Answers0