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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With