Sha256: ac2339b5513bd79c3b51bb921bb34295e6a8bbfad698b427ccf38cad80982de3
Contents?: true
Size: 505 Bytes
Versions: 56
Compression:
Stored size: 505 Bytes
Contents
# taken from ActiveSupport 2.3.2 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
56 entries across 56 versions & 6 rubygems