Sha256: 8ad6047abf64df7b2c9470bfe580511e616e106074c823c7d9f7eda876de6e6c

Contents?: true

Size: 472 Bytes

Versions: 201

Compression:

Stored size: 472 Bytes

Contents

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

201 entries across 168 versions & 25 rubygems

Version Path
gemstreamer-1.0.0 spec/assets/testapp/vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb
gemstreamer-0.0.0 spec/assets/testapp/vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb
radiant-rc-0.9.0 vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb
activesupport-2.2.3 lib/active_support/core_ext/symbol.rb
webroar-0.2.2 src/admin_panel/vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb
radiant-0.8.1 vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb
activesupport-2.3.4 lib/active_support/core_ext/symbol.rb
activesupport-2.3.3 lib/active_support/core_ext/symbol.rb
activesupport-2.3.2 lib/active_support/core_ext/symbol.rb
activesupport-2.2.2 lib/active_support/core_ext/symbol.rb
activesupport-2.1.1 lib/active_support/core_ext/symbol.rb
activesupport-2.1.2 lib/active_support/core_ext/symbol.rb
activesupport-2.1.0 lib/active_support/core_ext/symbol.rb
antfarm-0.3.0 rails/vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb
antfarm-0.4.0 rails/vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb
mack-active_record-0.8.2 lib/gems/activesupport-2.2.2/lib/active_support/core_ext/symbol.rb
mack-facets-0.8.3.1 lib/gems/activesupport-2.2.2/lib/active_support/core_ext/symbol.rb
mack-facets-0.8.3 lib/gems/activesupport-2.2.2/lib/active_support/core_ext/symbol.rb
radiant-0.7.0 vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb
radiant-0.7.1 vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb