lib/apportion.rb in apportion-0.0.1 vs lib/apportion.rb in apportion-0.0.2

- old
+ new

@@ -2,12 +2,10 @@ require 'apportion/setup' require 'apportion/util' # Top level interface, or API, to distribute a quantity among recipients module Apportion - include Apportion::Setup - include Apportion::Util module_function # Distributes a quantity among recipients by dividing proportionally according to relative # weights using the 'equal proportions' algorithm # @@ -20,12 +18,12 @@ # @example # division({a: 41, b: 32, c: 27}, 7) # # => {a: 3, b: 2, c: 2} def division(weights, size, options = {}) - portions = initial_portions(weights.keys, options) - sum_portions = hash_values_sum(portions) - validate(size, sum_portions) + portions = Setup.initial_portions(weights.keys, options) + sum_portions = Util.hash_values_sum(portions) + Setup.validate(size, sum_portions) next_step(weights, portions, sum_portions, size) end # recursively def next_step(weights, portions, sum_portions, size)