我想像使用splat一样将参数传递给 Proc ,但它返回错误wrong number of block arguments (1 for 0)
$callbacks = {} of String => Array(->)
def add_callback(event, &block)
begin
$callbacks[event.to_s] << block
rescue
$callbacks[event.to_s] = [block]
end
end
add_callback(:event) do |arg|
puts "event!"
end
$callbacks["event"].first.call
Error in line 11: wrong number of block arguments (1 for 0)
http://carc.in/#/r/7gw