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

Version Path
backlog-0.7.4 vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb
backlog-0.7.7 vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb
backlog-0.7.6 vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb
backlog-0.7.8 vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb
backlog-0.7.9 vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb
backlog-0.8.0 vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb
backlog-0.8.1 vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb
backlog-0.9.0 vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb
backlog-0.9.1 vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb
monetra-ruby-0.0.6 lib/monetra/active_support/core_ext/symbol.rb
radiant-0.6.1 vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb
radiant-0.6.0 vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb
radiant-0.6.2 vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb
radiant-0.6.3 vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb
radiant-0.6.4 vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb
rq-3.4.0 rails/vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb
rq-3.3.0 rails/vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb