diff options
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 |