<Toplevel Module>
<Built-in Module>
Object
(
Builtin-Module
)
1 unless :to_proc.respond_to?(:to_proc) 2 class Symbol 3 # Turns the symbol into a simple proc, which is especially useful for enumerations. Examples: 4 # 5 # # The same as people.collect { |p| p.name } 6 # people.collect(&:name) 7 # 8 # # The same as people.select { |p| p.manager? }.collect { |p| p.salary } 9 # people.select(&:manager?).collect(&:salary) 10 def to_proc 11 Proc.new { |*args| args.shift.__send__(self, *args) } 12 end 13 end 14 end