Method: String#to_proc

Defined in:
lib/extra/string.rb

#to_procObject

Convenience method for things such as array mapping. This is identical to the version in Symbol.

Example: [1, 2, 3].map(&'succ') #=> [2, 3, 4]

Returns: Proc object



50
51
52
# File 'lib/extra/string.rb', line 50

def to_proc
  proc { |obj| obj.__send__(self) }
end