Hi
I’m trying to add a method that receives a block as an argument via
define_method - but none of the following versions work.
Version1: (gives a syntax error - &block doesn’t seem to be allowed in block arguments)
define_method(:meth1) do |*args, &block|
block.call
end
Version2: (gives "No block given, altough I called methd2 with a block)
define_method(:meth2) do |*args|
Proc::new.call
end
Version3: (“No block given” - the same as before)
define_method(:meth3) do |*args|
yield
end
Is it possible to define methods that accept blocks as parameters using
define_method()?
greetings, Florian Pflug