Module: LareRound

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

Overview

module providing the entry point to the rounding logic

Defined Under Namespace

Classes: LareRoundError

Constant Summary collapse

VERSION =
'1.0.0'

Class Method Summary collapse

Class Method Details

.round(values, precision) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/lare_round.rb', line 7

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