Upgraded Rails and RSpec
[monkeycharger.git] / vendor / rails / activesupport / lib / active_support / core_ext / symbol.rb
blob54f541ad9ac7f0ddc0598b7af88ee196158c6020
1 unless :test.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