Class: CarmelHockey::Leader
- Inherits:
-
Object
- Object
- CarmelHockey::Leader
- 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
-
#player ⇒ Object
Returns the value of attribute player.
-
#team ⇒ Object
Returns the value of attribute team.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Leader
constructor
A new instance of Leader.
Methods included from HockeyModel
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
#player ⇒ Object
Returns the value of attribute player.
13 14 15 |
# File 'lib/carmel_hockey/leader.rb', line 13 def player @player end |
#team ⇒ Object
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 |