Class: Symbol

Inherits:
Object show all
Defined in:
lib/extra/symbol.rb

Instance Method Summary collapse

Instance Method Details

#to_procObject

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