Skip to content

Commit

Permalink
Ensure AR::Core#{slice,values_at} appear in RDoc [ci-skip]
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
jonathanhefner committed Oct 7, 2023
1 parent 6df4d3b commit c8b3642
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions activerecord/lib/active_record/core.rb
Expand Up @@ -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+.
#
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c8b3642

Please sign in to comment.