From 1979e9c8553f4d7905822fdcc99e52d179e78c3c Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Mon, 9 Nov 2009 21:11:26 +0100 Subject: Symbol#to_proc is not needed for Ruby >= 1.8.7 --- actionpack/test/controller/filters_test.rb | 1 - activerecord/lib/active_record/base.rb | 1 - activeresource/test/cases/base/load_test.rb | 1 - activesupport/lib/active_support/core_ext/symbol.rb | 1 - .../lib/active_support/core_ext/symbol/to_proc.rb | 14 -------------- activesupport/lib/active_support/ruby/shim.rb | 2 -- activesupport/test/core_ext/enumerable_test.rb | 1 - activesupport/test/core_ext/symbol_test.rb | 9 --------- activesupport/test/dependencies_test.rb | 1 - 9 files changed, 31 deletions(-) delete mode 100644 activesupport/lib/active_support/core_ext/symbol.rb delete mode 100644 activesupport/lib/active_support/core_ext/symbol/to_proc.rb delete mode 100644 activesupport/test/core_ext/symbol_test.rb diff --git a/actionpack/test/controller/filters_test.rb b/actionpack/test/controller/filters_test.rb index 2da97a9d86..8445428e8f 100644 --- a/actionpack/test/controller/filters_test.rb +++ b/actionpack/test/controller/filters_test.rb @@ -1,5 +1,4 @@ require 'abstract_unit' -require 'active_support/core_ext/symbol' class ActionController::Base class << self diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 4e6090458a..056f29f029 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -12,7 +12,6 @@ require 'active_support/core_ext/hash/deep_merge' require 'active_support/core_ext/hash/indifferent_access' require 'active_support/core_ext/hash/slice' require 'active_support/core_ext/string/behavior' -require 'active_support/core_ext/symbol' require 'active_support/core_ext/object/metaclass' module ActiveRecord #:nodoc: diff --git a/activeresource/test/cases/base/load_test.rb b/activeresource/test/cases/base/load_test.rb index 189a4d81fe..7745a9439b 100644 --- a/activeresource/test/cases/base/load_test.rb +++ b/activeresource/test/cases/base/load_test.rb @@ -1,7 +1,6 @@ require 'abstract_unit' require "fixtures/person" require "fixtures/street_address" -require 'active_support/core_ext/symbol' require 'active_support/core_ext/hash/conversions' module Highrise diff --git a/activesupport/lib/active_support/core_ext/symbol.rb b/activesupport/lib/active_support/core_ext/symbol.rb deleted file mode 100644 index c103cd9dcf..0000000000 --- a/activesupport/lib/active_support/core_ext/symbol.rb +++ /dev/null @@ -1 +0,0 @@ -require 'active_support/core_ext/symbol/to_proc' diff --git a/activesupport/lib/active_support/core_ext/symbol/to_proc.rb b/activesupport/lib/active_support/core_ext/symbol/to_proc.rb deleted file mode 100644 index 520369452b..0000000000 --- a/activesupport/lib/active_support/core_ext/symbol/to_proc.rb +++ /dev/null @@ -1,14 +0,0 @@ -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) - # - # This is a builtin method in Ruby 1.8.7 and later. - def to_proc - Proc.new { |*args| args.shift.__send__(self, *args) } - end unless :to_proc.respond_to?(:to_proc) -end diff --git a/activesupport/lib/active_support/ruby/shim.rb b/activesupport/lib/active_support/ruby/shim.rb index 37c57c485a..43e7ffc938 100644 --- a/activesupport/lib/active_support/ruby/shim.rb +++ b/activesupport/lib/active_support/ruby/shim.rb @@ -9,7 +9,6 @@ # Process Process.daemon # REXML security fix # String ord -# Symbol to_proc # Time to_date, to_time, to_datetime require 'active_support' require 'active_support/core_ext/date/calculations' @@ -20,5 +19,4 @@ require 'active_support/core_ext/object/tap' require 'active_support/core_ext/process/daemon' require 'active_support/core_ext/string/conversions' require 'active_support/core_ext/rexml' -require 'active_support/core_ext/symbol/to_proc' require 'active_support/core_ext/time/conversions' diff --git a/activesupport/test/core_ext/enumerable_test.rb b/activesupport/test/core_ext/enumerable_test.rb index 4170de3dce..a8e98891d3 100644 --- a/activesupport/test/core_ext/enumerable_test.rb +++ b/activesupport/test/core_ext/enumerable_test.rb @@ -1,6 +1,5 @@ require 'abstract_unit' require 'active_support/core_ext/array' -require 'active_support/core_ext/symbol' require 'active_support/core_ext/enumerable' Payment = Struct.new(:price) diff --git a/activesupport/test/core_ext/symbol_test.rb b/activesupport/test/core_ext/symbol_test.rb deleted file mode 100644 index 1eaccb9965..0000000000 --- a/activesupport/test/core_ext/symbol_test.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'abstract_unit' - -class SymbolTests < Test::Unit::TestCase - def test_to_proc - assert_equal %w(one two three), [:one, :two, :three].map(&:to_s) - assert_equal(%w(one two three), - {1 => "one", 2 => "two", 3 => "three"}.sort_by(&:first).map(&:last)) - end -end diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb index 97d70cf8c4..0fcf1eaf00 100644 --- a/activesupport/test/dependencies_test.rb +++ b/activesupport/test/dependencies_test.rb @@ -3,7 +3,6 @@ require 'pp' require 'active_support/dependencies' require 'active_support/core_ext/module/loading' require 'active_support/core_ext/kernel/reporting' -require 'active_support/core_ext/symbol/to_proc' module ModuleWithMissing mattr_accessor :missing_count -- cgit v1.2.3