Class: NbaRb::Player::BaseClass
- Inherits:
-
Object
- Object
- NbaRb::Player::BaseClass
- Includes:
- Initializable, StatsHash, StatsRequest
- Defined in:
- lib/nba_rb/player.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#only_current ⇒ Object
Returns the value of attribute only_current.
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(*args) ⇒ BaseClass
constructor
A new instance of BaseClass.
- #player_code ⇒ Object
- #rostered? ⇒ Boolean
- #team_abbreviation ⇒ Object
- #team_code ⇒ Object
- #team_id ⇒ Object
- #team_name ⇒ Object
Methods included from StatsHash
Methods included from StatsRequest
Constructor Details
#initialize(*args) ⇒ BaseClass
Returns a new instance of BaseClass.
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/nba_rb/player.rb', line 36 def initialize(*args) super(*args) last_formatted = last_name.downcase.capitalize first_formatted = first_name.downcase.capitalize name = "#{last_formatted}, #{first_formatted}" list = PlayerList.new.info list['rowSet'].each do |player| @data = player if player[1] == name end end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
31 32 33 |
# File 'lib/nba_rb/player.rb', line 31 def data @data end |
#first_name ⇒ Object
Returns the value of attribute first_name.
31 32 33 |
# File 'lib/nba_rb/player.rb', line 31 def first_name @first_name end |
#last_name ⇒ Object
Returns the value of attribute last_name.
31 32 33 |
# File 'lib/nba_rb/player.rb', line 31 def last_name @last_name end |
#only_current ⇒ Object
Returns the value of attribute only_current.
31 32 33 |
# File 'lib/nba_rb/player.rb', line 31 def only_current @only_current end |
Instance Method Details
#id ⇒ Object
49 50 51 |
# File 'lib/nba_rb/player.rb', line 49 def id @data[0] end |
#player_code ⇒ Object
53 54 55 |
# File 'lib/nba_rb/player.rb', line 53 def player_code @data[5] end |
#rostered? ⇒ Boolean
57 58 59 |
# File 'lib/nba_rb/player.rb', line 57 def rostered? @data[2].zero? end |
#team_abbreviation ⇒ Object
69 70 71 |
# File 'lib/nba_rb/player.rb', line 69 def team_abbreviation @data[9] end |
#team_code ⇒ Object
73 74 75 |
# File 'lib/nba_rb/player.rb', line 73 def team_code @data[10] end |
#team_id ⇒ Object
61 62 63 |
# File 'lib/nba_rb/player.rb', line 61 def team_id @data[6] end |
#team_name ⇒ Object
65 66 67 |
# File 'lib/nba_rb/player.rb', line 65 def team_name @data[7] + ' ' + @data[8] end |