s = Proc.new {|x|x*2}
puts s.call(5)
-> 10
def foo(&a)
a.call(5)
end
puts "test foo:"
foo(s)
When I try to call the proc above, I get:
foo: wrong number of arguments (1 for 0) (ArgumentError)
My expectation was that I can pass a proc to a method if the method is defined with this type of signature:
def foo(&a)
and then I can execute the proc insiide foo like this:
a.call(5)