Module: Lazier::Math::ClassMethods

Defined in:
lib/lazier/math.rb

Overview

General methods.

Instance Method Summary (collapse)

Instance Method Details

- (Object) max(*args)

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

- (Object) min(*args)

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