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

Version Path
andrewtimberlake-couch_potato-0.2.8.1 lib/core_ext/symbol.rb
andrewtimberlake-couch_potato-0.2.8.2 lib/core_ext/symbol.rb
andrewtimberlake-couch_potato-0.2.8.3 lib/core_ext/symbol.rb
andrewtimberlake-couch_potato-0.2.8.4 lib/core_ext/symbol.rb
langalex-couch_potato-0.2.11 lib/core_ext/symbol.rb
langalex-couch_potato-0.2.12 lib/core_ext/symbol.rb
langalex-couch_potato-0.2.8 lib/core_ext/symbol.rb
langalex-couch_potato-0.2.9 lib/core_ext/symbol.rb
couch_potato-0.6.0 lib/core_ext/symbol.rb
couch_potato-0.5.7 lib/core_ext/symbol.rb
couch_potato-rails2-0.5.10 lib/core_ext/symbol.rb
couch_potato-rails2-0.5.9 lib/core_ext/symbol.rb
couch_potato-rails2-0.5.8 lib/core_ext/symbol.rb
couch_potato-rails2-0.5.7 lib/core_ext/symbol.rb
couch_potato-rails2-0.5.6 lib/core_ext/symbol.rb
couch_potato-0.5.6 lib/core_ext/symbol.rb
couch_potato-0.5.5 lib/core_ext/symbol.rb
couch_potato-0.5.4 lib/core_ext/symbol.rb
couch_potato-0.5.3 lib/core_ext/symbol.rb
couch_potato-0.5.2 lib/core_ext/symbol.rb