From c8b3642eded5a25ee5cc11c48395bed05f92424e Mon Sep 17 00:00:00 2001 From: Jonathan Hefner Date: Mon, 10 Jul 2023 12:03:30 -0500 Subject: [PATCH] Ensure AR::Core#{slice,values_at} appear in RDoc [ci-skip] When a `:method:` doc is immediately followed by the `private` keyword, RDoc will hide that doc as if it were a private method. In #48324, the `:method:` docs for `ActiveRecord::Core#slice` and `ActiveRecord::Core#values_at` were swapped in an attempt to force `values_at` to appear in the rendered docs. However, doing so causes `slice` to dissappear from the rendered docs. To ensure that `slice` and `values_at` both appear in the rendered docs, this commit moves their `:method:` docs away from the `private` keyword in `ActiveRecord::Core`. --- activerecord/lib/active_record/core.rb | 42 +++++++++++++------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index aa91c74506254..6101eac6dbd84 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -536,6 +536,27 @@ def encode_with(coder) coder["active_record_yaml_version"] = 2 end + ## + # :method: slice + # + # :call-seq: slice(*methods) + # + # Returns a hash of the given methods with their names as keys and returned + # values as values. + # + #-- + # Implemented by ActiveModel::Access#slice. + + ## + # :method: values_at + # + # :call-seq: values_at(*methods) + # + # Returns an array of the values returned by the given methods. + # + #-- + # Implemented by ActiveModel::Access#values_at. + # Returns true if +comparison_object+ is the same exact object, or +comparison_object+ # is of the same type and +self+ has an ID and it is equal to +comparison_object.id+. # @@ -701,27 +722,6 @@ def pretty_print(pp) end end - ## - # :method: values_at - # - # :call-seq: values_at(*methods) - # - # Returns an array of the values returned by the given methods. - # - #-- - # Implemented by ActiveModel::Access#values_at. - - ## - # :method: slice - # - # :call-seq: slice(*methods) - # - # Returns a hash of the given methods with their names as keys and returned - # values as values. - # - #-- - # Implemented by ActiveModel::Access#slice. - private # +Array#flatten+ will call +#to_ary+ (recursively) on each of the elements of # the array, and then rescues from the possible +NoMethodError+. If those elements are