Sha256: aa72a942e9160195a317108d075eeb27f97a65b604ae3a2722b5ac2e343f3598
Contents?: true
Size: 406 Bytes
Versions: 77
Compression:
Stored size: 406 Bytes
Contents
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
Version data entries
77 entries across 77 versions & 6 rubygems