File tree Expand file tree Collapse file tree 4 files changed +6
-6
lines changed
lib/active_support/core_ext Expand file tree Collapse file tree 4 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 1- * Added Object#self which returns the object itself. Useful when dealing with a chaining scenario, like Active Record scopes:
1+ * Added Object#itself which returns the object itself. Useful when dealing with a chaining scenario, like Active Record scopes:
22
3- Event.public_send(state.presence_in?([ :trashed, :drafted ]) ? :self ).order(:created_at)
3+ Event.public_send(state.presence_in?([ :trashed, :drafted ]) || :itself ).order(:created_at)
44
55 * DHH*
66
Original file line number Diff line number Diff line change 22require 'active_support/core_ext/object/blank'
33require 'active_support/core_ext/object/duplicable'
44require 'active_support/core_ext/object/deep_dup'
5- require 'active_support/core_ext/object/self '
5+ require 'active_support/core_ext/object/itself '
66require 'active_support/core_ext/object/try'
77require 'active_support/core_ext/object/inclusion'
88
Original file line number Diff line number Diff line change 11class Object
22 # Returns the object itself. Useful when dealing with a chaining scenario, like Active Record scopes:
33 #
4- # Event.public_send(state.presence_in?([ :trashed, :drafted ]) ? :self ).order(:created_at)
4+ # Event.public_send(state.presence_in?([ :trashed, :drafted ]) || :itself ).order(:created_at)
55 #
66 # @return Object
7- def self
7+ def itself
88 self
99 end
1010end
Original file line number Diff line number Diff line change 44class Object ::SelfTest < ActiveSupport ::TestCase
55 test 'self returns self' do
66 object = 'fun'
7- assert_equal object , object . self
7+ assert_equal object , object . itself
88 end
99end
You can’t perform that action at this time.
0 commit comments