1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Removed Object#itself as it's implemented in ruby 2.2

This commit is contained in:
Cristian Bica 2014-12-29 23:04:54 +02:00
parent 4be29e5b5d
commit 7217391fc7
3 changed files with 0 additions and 25 deletions

View file

@ -2,7 +2,6 @@ require 'active_support/core_ext/object/acts_like'
require 'active_support/core_ext/object/blank'
require 'active_support/core_ext/object/duplicable'
require 'active_support/core_ext/object/deep_dup'
require 'active_support/core_ext/object/itself'
require 'active_support/core_ext/object/try'
require 'active_support/core_ext/object/inclusion'

View file

@ -1,15 +0,0 @@
class Object
# TODO: Remove this file when we drop support for Ruby < 2.2
unless respond_to?(:itself)
# Returns the object itself.
#
# Useful for chaining methods, such as Active Record scopes:
#
# Event.public_send(state.presence_in([ :trashed, :drafted ]) || :itself).order(:created_at)
#
# @return Object
def itself
self
end
end
end

View file

@ -1,9 +0,0 @@
require 'abstract_unit'
require 'active_support/core_ext/object'
class Object::ItselfTest < ActiveSupport::TestCase
test 'itself returns self' do
object = 'fun'
assert_equal object, object.itself
end
end