Module: Splittable

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

Defined Under Namespace

Classes: Division, Normalize

Constant Summary collapse

VERSION =
'0.0.9'

Class Method Summary collapse

Class Method Details

.division(value:, quantity:, precision: 2) ⇒ Object

receive total value and to quantity installments are required to equal division just the first installment will receive the difference cents



12
13
14
# File 'lib/splittable.rb', line 12

def division(value:, quantity:, precision: 2)
  Splittable::Division.new(value: value, quantity: quantity, precision: precision).call
end

.normalize(value:, installments:, precision: 2) ⇒ Object

receive total value and specific value of installments are required to specific division just the first installment will receive the difference cents



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

def normalize(value:, installments:, precision: 2)
  Splittable::Normalize.new(value: value, installments: installments, precision: precision).call
end