Class: NBAPlayerAPI::StatCard
- Inherits:
-
Object
- Object
- NBAPlayerAPI::StatCard
- Defined in:
- lib/nba_player_api/stat_card.rb
Instance Attribute Summary collapse
-
#assists ⇒ Object
readonly
Returns the value of attribute assists.
-
#player ⇒ Object
readonly
Returns the value of attribute player.
-
#points ⇒ Object
readonly
Returns the value of attribute points.
-
#rebounds ⇒ Object
readonly
Returns the value of attribute rebounds.
-
#year ⇒ Object
readonly
Returns the value of attribute year.
Instance Method Summary collapse
-
#initialize(player, stats) ⇒ StatCard
constructor
basic initialization with attributes.
- #to_s ⇒ Object
Constructor Details
#initialize(player, stats) ⇒ StatCard
basic initialization with attributes
8 9 10 11 12 13 14 |
# File 'lib/nba_player_api/stat_card.rb', line 8 def initialize(player, stats) @player = player @year = stats[0].to_i @points = stats[1] @rebounds = stats[2] @assists = stats[3] end |
Instance Attribute Details
#assists ⇒ Object (readonly)
Returns the value of attribute assists.
4 5 6 |
# File 'lib/nba_player_api/stat_card.rb', line 4 def assists @assists end |
#player ⇒ Object (readonly)
Returns the value of attribute player.
4 5 6 |
# File 'lib/nba_player_api/stat_card.rb', line 4 def player @player end |
#points ⇒ Object (readonly)
Returns the value of attribute points.
4 5 6 |
# File 'lib/nba_player_api/stat_card.rb', line 4 def points @points end |
#rebounds ⇒ Object (readonly)
Returns the value of attribute rebounds.
4 5 6 |
# File 'lib/nba_player_api/stat_card.rb', line 4 def rebounds @rebounds end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
4 5 6 |
# File 'lib/nba_player_api/stat_card.rb', line 4 def year @year end |
Instance Method Details
#to_s ⇒ Object
16 17 18 |
# File 'lib/nba_player_api/stat_card.rb', line 16 def to_s "Player: #{player.to_s} | Year: #{year} | Points: #{points} | Rebounds: #{rebounds} | Assists: #{assists} " end |