Module: Sorare::Rewards::Transposer
- Defined in:
- lib/sorare/rewards/transposer.rb
Overview
TransposeAllocations transposes the computed allocations { ‘league’ => { ‘rarity’ => { ‘division’ => … } } } to a division based allocations { ‘league’ => { ‘division’ => { ‘rarity’ => … } } }
Class Method Summary collapse
Class Method Details
.transpose_allocations(allocations) ⇒ Object
12 13 14 15 16 |
# File 'lib/sorare/rewards/transposer.rb', line 12 def self.transpose_allocations(allocations) allocations.keys.index_with do |league| transpose_league(allocations[league]) end end |
.transpose_league(allocations) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/sorare/rewards/transposer.rb', line 18 def self.transpose_league(allocations) allocations.each_with_object({}) do |(rarity, league_allocations), hash| league_allocations.each do |division, supply| hash[division] = {} unless hash[division] hash[division][rarity] = supply end end end |