I would like to pass in an generated(higher order function) to a method to a ruby method . Something like this
[].select give_block
def give_block
lambda { |e| e > 1 }
end
I get an error saying
"wrong number of arguments (1 for 0)"
How could开发者_开发技巧 i accomplish something like this?
[].select(&give_block)
will do the trick
精彩评论