Class: DivideByType

Inherits:
Object show all
Defined in:
lib/guerrilla_patch/aggregate_by_type/divide_by_type.rb

Class Method Summary collapse

Class Method Details

.divide(ratios, amount) ⇒ Object



2
3
4
5
6
7
# File 'lib/guerrilla_patch/aggregate_by_type/divide_by_type.rb', line 2

def self.divide(ratios, amount)
  return {} if amount == 0
  ratios = { :no_division => 1 } if ratios == {}

  Hash[ ratios.each_key.zip(allocate(amount, ratios.each_value)) ]
end