Module: Lazier::Math::ClassMethods

Defined in:
lib/lazier/math.rb

Overview

General methods.

Instance Method Summary collapse

Instance Method Details

#max(*args) ⇒ Object

Returns the maximum value in the arguments

Parameters:

  • args (Array)

    A mapion of object to compare (with the > operator).

Returns:

  • (Object)

    The maximum value or nil (if the mapion is empty).



26
27
28
# File 'lib/lazier/math.rb', line 26

def max(*args)
  args.ensure_array.flatten.max
end

#min(*args) ⇒ Object

Returns the minimum value in the arguments

Parameters:

  • args (Array)

    A mapion of object to compare (with the < operator).

Returns:

  • (Object)

    The minimum value or nil (if the mapion is empty).



18
19
20
# File 'lib/lazier/math.rb', line 18

def min(*args)
  args.ensure_array.flatten.min
end