T
Tony Arcieri
[Note: parts of this message were removed to make it a legal post.]
class A
def a
'yay'
end
end
class B
def initialize(&meth)
class << self; self; end.__send__define_method, :b, &meth)
end
end
b = B.new &A.new.methoda)
p b.b
Ruby 1.8 prints:
"yay"
Ruby 1.9 complains (on the p b.b line):
14:in `<main>': wrong number of arguments (1 for 0) (ArgumentError)
class A
def a
'yay'
end
end
class B
def initialize(&meth)
class << self; self; end.__send__define_method, :b, &meth)
end
end
b = B.new &A.new.methoda)
p b.b
Ruby 1.8 prints:
"yay"
Ruby 1.9 complains (on the p b.b line):
14:in `<main>': wrong number of arguments (1 for 0) (ArgumentError)