instance method
maximum
Ruby on Rails 7.2.3
Since v7.0.10Signature
maximum(key)
Calculates the maximum from the extracted elements.
payments = [Payment.new(5), Payment.new(15), Payment.new(10)] payments.maximum(:price) # => 15
Parameters
-
keyreq
Source
# File activesupport/lib/active_support/core_ext/enumerable.rb, line 40
def maximum(key)
map(&key).max
end
Defined in activesupport/lib/active_support/core_ext/enumerable.rb line 40
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Enumerable