public
Created

  • Download Gist
test.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
class A
def foo
"lol"
end
end
 
class B < A
def self.add_foo
define_method :foo do
super
end
end
end
 
B.add_foo
p B.new.foo
 
# $ ruby test.rb
# test.rb:10:in `block in add_foo': implicit argument passing of super from method defined by define_method() is not supported. Specify all arguments explicitly. (RuntimeError)
# from test.rb:16:in `<main>'

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.