假设我是猴子修补类中的方法,我怎么能从覆盖方法调用重写方法?就像有点像super
super
例如
class Foo def bar() "Hello" end end class Foo def bar() super() + " World" end end >> Foo.new.bar == "Hello World"
ruby monkeypatching
monkeypatching ×1
ruby ×1