Module: LareRound

Defined in:
lib/lare_round.rb,
lib/lare_round/version.rb

Defined Under Namespace

Classes: LareRoundError

Constant Summary collapse

VERSION =
'0.0.2'

Class Method Summary collapse

Class Method Details

.round(values, precision) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/lare_round.rb', line 4

def self.round(values, precision)
  # although it is the senders responsibility to ensure that correct messages
  # are sent to this module it might not be quite obvious so i provide some
  # help here with errors if input is invalid
  array_of_values = values.is_a?(Hash) ? values.values : values
  handle_value_errors(array_of_values)
  handle_precision_errors(precision)

  process(values, precision)
end