Sha256: 045520d2d100acb15a177ec7b63ad06df37ed28ef95b1c96f3a46d7d32a788c7
Contents?: true
Size: 529 Bytes
Versions: 19
Compression:
Stored size: 529 Bytes
Contents
#!/usr/local/bin/ruby -w # # == extensions/symbol.rb # # Adds methods to the builtin Symbol class. # require "extensions/_base" # # * Symbol#to_proc # ExtensionsProject.implement(Symbol, :to_proc) do class Symbol # # Allows a Symbol to be implicitly converted to a Proc. # # This allows such conveniences as: # %{john terry fiona}.map(&:capitalize) # -> %{John Terry Fiona} # sum = numbers.inject(&:+) # def to_proc proc { |obj, *args| obj.send(self, *args) } end end end
Version data entries
19 entries across 19 versions & 4 rubygems