From 64d91122222c11ad3918cc8e2e3ebc4b0a03448a Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 1 Aug 2014 10:30:13 -0700 Subject: Rename Object#self to Object#itself to have parity with matz sanctioned method name for Ruby 2.2 --- activesupport/lib/active_support/core_ext/object.rb | 2 +- activesupport/lib/active_support/core_ext/object/itself.rb | 10 ++++++++++ activesupport/lib/active_support/core_ext/object/self.rb | 10 ---------- 3 files changed, 11 insertions(+), 11 deletions(-) create mode 100644 activesupport/lib/active_support/core_ext/object/itself.rb delete mode 100644 activesupport/lib/active_support/core_ext/object/self.rb (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/object.rb b/activesupport/lib/active_support/core_ext/object.rb index 2646342b2e..f1106cca9b 100644 --- a/activesupport/lib/active_support/core_ext/object.rb +++ b/activesupport/lib/active_support/core_ext/object.rb @@ -2,7 +2,7 @@ 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/self' +require 'active_support/core_ext/object/itself' require 'active_support/core_ext/object/try' require 'active_support/core_ext/object/inclusion' diff --git a/activesupport/lib/active_support/core_ext/object/itself.rb b/activesupport/lib/active_support/core_ext/object/itself.rb new file mode 100644 index 0000000000..df613c4e4f --- /dev/null +++ b/activesupport/lib/active_support/core_ext/object/itself.rb @@ -0,0 +1,10 @@ +class Object + # Returns the object itself. Useful when dealing with a chaining scenario, like Active Record scopes: + # + # Event.public_send(state.presence_in?([ :trashed, :drafted ]) || :itself).order(:created_at) + # + # @return Object + def itself + self + end +end \ No newline at end of file diff --git a/activesupport/lib/active_support/core_ext/object/self.rb b/activesupport/lib/active_support/core_ext/object/self.rb deleted file mode 100644 index 5c51bf56c9..0000000000 --- a/activesupport/lib/active_support/core_ext/object/self.rb +++ /dev/null @@ -1,10 +0,0 @@ -class Object - # Returns the object itself. Useful when dealing with a chaining scenario, like Active Record scopes: - # - # Event.public_send(state.presence_in?([ :trashed, :drafted ]) ? :self).order(:created_at) - # - # @return Object - def self - self - end -end \ No newline at end of file -- cgit v1.2.3