module Enumerable

def maximum(key)

payments.maximum(:price) # => 15
payments = [Payment.new(5), Payment.new(15), Payment.new(10)]

Calculates the maximum from the extracted elements.
def maximum(key)
  map(&key).max
end