diff options
author | Xavier Noria <fxn@hashref.com> | 2009-11-09 21:23:19 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2009-11-09 22:16:51 +0100 |
commit | f8e713f488bba264ba73251b56ad56385b8ed824 (patch) | |
tree | 6896e592230e2ad54daf1ff4115868d494638687 /activesupport/lib/active_support | |
parent | 1979e9c8553f4d7905822fdcc99e52d179e78c3c (diff) | |
download | rails-f8e713f488bba264ba73251b56ad56385b8ed824.tar.gz rails-f8e713f488bba264ba73251b56ad56385b8ed824.tar.bz2 rails-f8e713f488bba264ba73251b56ad56385b8ed824.zip |
Object#tap is not needed for Ruby >= 1.8.7
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/core_ext/object/misc.rb | 1 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/object/tap.rb | 16 | ||||
-rw-r--r-- | activesupport/lib/active_support/ruby/shim.rb | 2 |
3 files changed, 0 insertions, 19 deletions
diff --git a/activesupport/lib/active_support/core_ext/object/misc.rb b/activesupport/lib/active_support/core_ext/object/misc.rb index 80011dfbed..3e3af03cc5 100644 --- a/activesupport/lib/active_support/core_ext/object/misc.rb +++ b/activesupport/lib/active_support/core_ext/object/misc.rb @@ -1,3 +1,2 @@ require 'active_support/core_ext/object/returning' -require 'active_support/core_ext/object/tap' require 'active_support/core_ext/object/with_options' diff --git a/activesupport/lib/active_support/core_ext/object/tap.rb b/activesupport/lib/active_support/core_ext/object/tap.rb deleted file mode 100644 index db7e715e2d..0000000000 --- a/activesupport/lib/active_support/core_ext/object/tap.rb +++ /dev/null @@ -1,16 +0,0 @@ -class Object - # Yields <code>x</code> to the block, and then returns <code>x</code>. - # The primary purpose of this method is to "tap into" a method chain, - # in order to perform operations on intermediate results within the chain. - # - # (1..10).tap { |x| puts "original: #{x.inspect}" }.to_a. - # tap { |x| puts "array: #{x.inspect}" }. - # select { |x| x%2 == 0 }. - # tap { |x| puts "evens: #{x.inspect}" }. - # map { |x| x*x }. - # tap { |x| puts "squares: #{x.inspect}" } - def tap - yield self - self - end unless Object.respond_to?(:tap) -end diff --git a/activesupport/lib/active_support/ruby/shim.rb b/activesupport/lib/active_support/ruby/shim.rb index 43e7ffc938..1f47c04826 100644 --- a/activesupport/lib/active_support/ruby/shim.rb +++ b/activesupport/lib/active_support/ruby/shim.rb @@ -5,7 +5,6 @@ # DateTime to_date, to_datetime, xmlschema # Enumerable group_by, each_with_object, none? # Integer even?, odd? -# Object tap # Process Process.daemon # REXML security fix # String ord @@ -15,7 +14,6 @@ require 'active_support/core_ext/date/calculations' require 'active_support/core_ext/date_time/conversions' require 'active_support/core_ext/enumerable' require 'active_support/core_ext/integer/even_odd' -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' |