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 between the arguments.

Parameters:

  • args (Array)

    A list of objects to compare (with the > operator).

Returns:

  • (Object)

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



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

def max(*args)
  args.ensure_array(default: [], no_duplicates: true, compact: true, flatten: true).max
end

#min(*args) ⇒ Object

Returns the minimum value between the arguments.

Parameters:

  • args (Array)

    A list of objects to compare (with the < operator).

Returns:

  • (Object)

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



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

def min(*args)
  args.ensure_array(default: [], no_duplicates: true, compact: true, flatten: true).min
end