Ticket #8812: enum_to_proc_note.patch
| File enum_to_proc_note.patch, 0.7 kB (added by lifofifo, 2 years ago) |
|---|
-
activesupport/lib/active_support/core_ext/symbol.rb
old new 6 6 # 7 7 # # The same as people.select { |p| p.manager? }.collect { |p| p.salary } 8 8 # people.select(&:manager?).collect(&:salary) 9 # 10 # PERFORMANCE ISSUE : The enumerations shortcut explained above, shouldn't be used for fairly large sized collections as 11 # it can have serious performance implications. 12 # 9 13 def to_proc 10 14 Proc.new { |*args| args.shift.__send__(self, *args) } 11 15 end