Sha256: 68e7d8da59ac8f1776bd3fbe73772eb06328725b87282fb3c67dbe98050cf83b
Contents?: true
Size: 483 Bytes
Versions: 6
Compression:
Stored size: 483 Bytes
Contents
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com # All files in this distribution are subject to the terms of the Ruby license. # Extensions for Symbol class Symbol # the well-known #to_proc # creates a lambda that sends the symbol and any further arguments # to the object yielded. # [1, 2, 3].map(&:to_s) # => ['1', '2', '3'] # %w[a b c].map(&:to_sym) # => [:a, :b, :c] def to_proc lambda{|o, *args| o.send(self, *args) } end end
Version data entries
6 entries across 6 versions & 1 rubygems