Class: Symbol
Instance Method Summary collapse
-
#to_proc ⇒ Object
Credit to whomever posted this on the mailing list :).
Instance Method Details
#to_proc ⇒ Object
Credit to whomever posted this on the mailing list :)
Convenience method for things such as array mapping.
Example: <tt>[1, 2, 3].map(&:succ) #=> [2, 3, 4]<tt>
Returns: Proc object
10 11 12 |
# File 'lib/extra/symbol.rb', line 10 def to_proc proc { |obj| obj.__send__(self) } end |