diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2014-08-01 10:30:13 -0700 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2014-08-01 10:30:13 -0700 |
commit | 64d91122222c11ad3918cc8e2e3ebc4b0a03448a (patch) | |
tree | 0935257a8c61fd59e52cb1a25388ce709c006a3d /activesupport | |
parent | 702ad710b57bef45b081ebf42e6fa70820fdd810 (diff) | |
download | rails-64d91122222c11ad3918cc8e2e3ebc4b0a03448a.tar.gz rails-64d91122222c11ad3918cc8e2e3ebc4b0a03448a.tar.bz2 rails-64d91122222c11ad3918cc8e2e3ebc4b0a03448a.zip |
Rename Object#self to Object#itself to have parity with matz sanctioned method name for Ruby 2.2
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/CHANGELOG.md | 4 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/object.rb | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/object/itself.rb (renamed from activesupport/lib/active_support/core_ext/object/self.rb) | 4 | ||||
-rw-r--r-- | activesupport/test/core_ext/object/itself_test.rb (renamed from activesupport/test/core_ext/object/self_test.rb) | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index cb57ad0e0a..72fa6722b5 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,6 +1,6 @@ -* Added Object#self which returns the object itself. Useful when dealing with a chaining scenario, like Active Record scopes: +* Added Object#itself which 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) + Event.public_send(state.presence_in?([ :trashed, :drafted ]) || :itself).order(:created_at) *DHH* 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/self.rb b/activesupport/lib/active_support/core_ext/object/itself.rb index 5c51bf56c9..df613c4e4f 100644 --- a/activesupport/lib/active_support/core_ext/object/self.rb +++ b/activesupport/lib/active_support/core_ext/object/itself.rb @@ -1,10 +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 ]) ? :self).order(:created_at) + # Event.public_send(state.presence_in?([ :trashed, :drafted ]) || :itself).order(:created_at) # # @return Object - def self + def itself self end end
\ No newline at end of file diff --git a/activesupport/test/core_ext/object/self_test.rb b/activesupport/test/core_ext/object/itself_test.rb index 751199e41c..0885fe91e3 100644 --- a/activesupport/test/core_ext/object/self_test.rb +++ b/activesupport/test/core_ext/object/itself_test.rb @@ -4,6 +4,6 @@ require 'active_support/core_ext/object' class Object::SelfTest < ActiveSupport::TestCase test 'self returns self' do object = 'fun' - assert_equal object, object.self + assert_equal object, object.itself end end |