Sha256: 49fdda3388fdd3b278601dfceed1b6aa096dab9852ad3fec4c7e071e596eda6d
Contents?: true
Size: 758 Bytes
Versions: 9
Compression:
Stored size: 758 Bytes
Contents
# Taken from Active Support (copyright (c) 2005-2008 David Heinemeier Hansson), # which is realeased under the MIT license as part of the Ruby on Rails framework. # http://github.com/rails/rails/blob/babbc1580da9e4a23921ab68d47c7c0d2e8447da/activesupport/lib/active_support/core_ext/symbol.rb unless :to_proc.respond_to?(:to_proc) class Symbol # Turns the symbol into a simple proc, which is especially useful for enumerations. Examples: # # # The same as people.collect { |p| p.name } # people.collect(&:name) # # # The same as people.select { |p| p.manager? }.collect { |p| p.salary } # people.select(&:manager?).collect(&:salary) def to_proc Proc.new { |*args| args.shift.__send__(self, *args) } end end end
Version data entries
9 entries across 9 versions & 1 rubygems