Class Money::Allocation
In: lib/money/money/allocation.rb
Parent: Object

Methods

generate  

Public Class methods

Splits a given amount in parts without loosing pennies. The left-over pennies will be distributed round-robin amongst the parties. This means that parties listed first will likely receive more pennies than ones that are listed later.

The results should always add up to the original amount.

The parts can be specified as:

  Numeric — performs the split between a given number of parties evenely
  Array<Numeric> — allocates the amounts proportionally to the given array

[Validate]