Class: CarmelHockey::Leader

Inherits:
Object
  • Object
show all
Extended by:
Memoist
Includes:
HockeyModel
Defined in:
lib/carmel_hockey/leader.rb

Constant Summary collapse

COLUMNS =
i[
  rank _name number position _team
  games_played goals assists
  points points_per_game penalty_minutes
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HockeyModel

#attributes

Constructor Details

#initialize(attributes = {}) ⇒ Leader



16
17
18
19
20
21
22
# File 'lib/carmel_hockey/leader.rb', line 16

def initialize(attributes = {})
  super
  self.points_per_game = points_per_game.to_f
  i[goals assists games_played rank points penalty_minutes number].each do |attr|
    send("#{attr}=", send(attr).to_i)
  end
end

Instance Attribute Details

#playerObject

Returns the value of attribute player.



13
14
15
# File 'lib/carmel_hockey/leader.rb', line 13

def player
  @player
end

#teamObject

Returns the value of attribute team.



13
14
15
# File 'lib/carmel_hockey/leader.rb', line 13

def team
  @team
end

Class Method Details

.all(season:) ⇒ Object



27
28
29
# File 'lib/carmel_hockey/leader.rb', line 27

def all(season:)
  seasons[season] ||= leaders_for(season)
end