You should be able to do this with
my_collection.each &method(:my_method)
method - , Object, method. method , , to_proc, &. proc , to_proc , . , , :
def my_method(a,b)
puts "#{b}: #{a}"
end
:
[1,2,3,4].each.with_index &:method(:my_method)
:
[1,2,3,4].each.with_index do |a,b|
puts "#{b}: #{a}"
end