Sha256: 7c4f30c974b253655dd2bfae79f7118b4049b9bcda482b2c1539369bb3508a74
Contents?: true
Size: 469 Bytes
Versions: 27
Compression:
Stored size: 469 Bytes
Contents
unless :test.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
27 entries across 27 versions & 6 rubygems