Class: Sorare::Rewards::GameWeekAllocations

Inherits:
Object
  • Object
show all
Defined in:
lib/sorare/rewards/game_week_allocations.rb

Overview

GameWeekAllocations stores the expected allocations for a game week

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(allocations) ⇒ GameWeekAllocations

Returns a new instance of GameWeekAllocations.



9
10
11
# File 'lib/sorare/rewards/game_week_allocations.rb', line 9

def initialize(allocations)
  @allocations = allocations
end

Instance Attribute Details

#allocationsObject (readonly)

Returns the value of attribute allocations.



7
8
9
# File 'lib/sorare/rewards/game_week_allocations.rb', line 7

def allocations
  @allocations
end

Instance Method Details

#each_league_allocationsObject



13
14
15
16
17
18
19
# File 'lib/sorare/rewards/game_week_allocations.rb', line 13

def each_league_allocations
  allocations.each_key do |league_name|
    return to_enum(:each_league_allocations) unless block_given?

    yield(league_name, allocations[league_name])
  end
end

#each_league_rarity_allocationsObject



21
22
23
24
25
26
27
28
29
# File 'lib/sorare/rewards/game_week_allocations.rb', line 21

def each_league_rarity_allocations
  each_league_allocations do |league_name, league_allocations|
    league_allocations.each_key do |rarity|
      return to_enum(:each_league_rarity_allocations) unless block_given?

      yield(league_name, rarity, league_allocations[rarity])
    end
  end
end