提交 7217391f 编写于 作者: C Cristian Bica

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

上级 4be29e5b
......@@ -2,7 +2,6 @@
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'
......
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
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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册