I want to store several different methods in an array in Ruby. Suppose I want to store the type
method twice:
[type, type]
doesn't store two entries of type
in an array; it executes type
twice, and stores the results in the array. how do I refer explicitly to the method object itself?
(this is just a simplified version of what I really want.)
EDIT: on second thoughts, it bothers me that the solution proposed below avoids the problem by passing the name of the method. how do you pass the method object itself? for example, what if you pass [:type, :type] to a method that has an alternative resolution for type? how can you pass the type method object itself?