I want to send an method to each object in an Array. I know I can do something like this
array = ...
array.each { |obj| obj.some_method }
But is there a method where I can do something like the following?
array = ...
array.send_each :some_method
Use Symbol#to_proc:
array.each(&:some_method)
array.each{ |object| object.some_method }. Use that version if you need to pass parameters to the method.array.each(&Proc.new { |x| x.some_method }).