Class: NBAPlayerAPI::StatCard

Inherits:
Object
  • Object
show all
Defined in:
lib/nba_player_api/stat_card.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#assistsObject (readonly)

Returns the value of attribute assists.



4
5
6
# File 'lib/nba_player_api/stat_card.rb', line 4

def assists
  @assists
end

#playerObject (readonly)

Returns the value of attribute player.



4
5
6
# File 'lib/nba_player_api/stat_card.rb', line 4

def player
  @player
end

#pointsObject (readonly)

Returns the value of attribute points.



4
5
6
# File 'lib/nba_player_api/stat_card.rb', line 4

def points
  @points
end

#reboundsObject (readonly)

Returns the value of attribute rebounds.



4
5
6
# File 'lib/nba_player_api/stat_card.rb', line 4

def rebounds
  @rebounds
end

#yearObject (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_sObject



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