Permalink
Browse files

Object#tap is not needed for Ruby >= 1.8.7

  • Loading branch information...
1 parent 1979e9c commit f8e713f488bba264ba73251b56ad56385b8ed824 @fxn fxn committed Nov 9, 2009
@@ -5,7 +5,6 @@
require 'active_support/memoizable'
require 'active_support/core_ext/array/wrap'
require 'active_support/core_ext/hash/indifferent_access'
-require 'active_support/core_ext/object/tap'
require 'active_support/core_ext/string/access'
module ActionDispatch
@@ -1,5 +1,3 @@
-require 'active_support/core_ext/object/tap'
-
module ActiveRecord
module AttributeMethods
module Dirty
@@ -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'
@@ -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
@@ -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_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'
@@ -1,9 +0,0 @@
-require 'abstract_unit'
-require 'active_support/core_ext/object/metaclass'
-
-class ObjectExtTest < Test::Unit::TestCase
- def test_tap_yields_and_returns_self
- foo = Object.new
- assert_equal foo, foo.tap { |x| assert_equal foo, x; :bar }
- end
-end

0 comments on commit f8e713f

Please sign in to comment.