Class: NBA::Player
- Inherits:
-
Shale::Mapper
- Object
- Shale::Mapper
- NBA::Player
- Defined in:
- lib/nba/player.rb
Overview
Represents an NBA player
Instance Attribute Summary collapse
-
#college ⇒ String
Returns the player’s college.
-
#country ⇒ String
Returns the player’s country.
-
#draft_number ⇒ Integer
Returns the number the player was drafted.
-
#draft_round ⇒ Integer
Returns the round the player was drafted.
-
#draft_year ⇒ Integer
Returns the year the player was drafted.
-
#first_name ⇒ String
Returns the player’s first name.
-
#full_name ⇒ String
Returns the player’s full name.
-
#height ⇒ String
Returns the player’s height.
-
#id ⇒ Integer
Returns the unique identifier for the player.
-
#is_active ⇒ Boolean
(also: #active?)
Returns whether the player is currently active.
-
#jersey_number ⇒ Integer
Returns the player’s jersey number.
-
#last_name ⇒ String
Returns the player’s last name.
-
#position ⇒ Position
Returns the player’s position.
-
#team ⇒ Team
Returns the player’s current team.
-
#weight ⇒ Integer
Returns the player’s weight.
Instance Method Summary collapse
-
#center? ⇒ Boolean
Returns whether the player is a center.
-
#forward? ⇒ Boolean
Returns whether the player is a forward.
-
#guard? ⇒ Boolean
Returns whether the player is a guard.
-
#point_guard? ⇒ Boolean
Returns whether the player is a point guard.
-
#power_forward? ⇒ Boolean
Returns whether the player is a power forward.
-
#shooting_guard? ⇒ Boolean
Returns whether the player is a shooting guard.
-
#small_forward? ⇒ Boolean
Returns whether the player is a small forward.
Instance Attribute Details
#college ⇒ String
Returns the player’s college
89 |
# File 'lib/nba/player.rb', line 89 attribute :college, Shale::Type::String |
#country ⇒ String
Returns the player’s country
97 |
# File 'lib/nba/player.rb', line 97 attribute :country, Shale::Type::String |
#draft_number ⇒ Integer
Returns the number the player was drafted
121 |
# File 'lib/nba/player.rb', line 121 attribute :draft_number, Shale::Type::Integer |
#draft_round ⇒ Integer
Returns the round the player was drafted
113 |
# File 'lib/nba/player.rb', line 113 attribute :draft_round, Shale::Type::Integer |
#draft_year ⇒ Integer
Returns the year the player was drafted
105 |
# File 'lib/nba/player.rb', line 105 attribute :draft_year, Shale::Type::Integer |
#first_name ⇒ String
Returns the player’s first name
33 |
# File 'lib/nba/player.rb', line 33 attribute :first_name, Shale::Type::String |
#full_name ⇒ String
Returns the player’s full name
25 |
# File 'lib/nba/player.rb', line 25 attribute :full_name, Shale::Type::String |
#height ⇒ String
Returns the player’s height
73 |
# File 'lib/nba/player.rb', line 73 attribute :height, Shale::Type::String |
#id ⇒ Integer
Returns the unique identifier for the player
17 |
# File 'lib/nba/player.rb', line 17 attribute :id, Shale::Type::Integer |
#is_active ⇒ Boolean Also known as: active?
Returns whether the player is currently active
49 |
# File 'lib/nba/player.rb', line 49 attribute :is_active, Shale::Type::Boolean |
#jersey_number ⇒ Integer
Returns the player’s jersey number
57 |
# File 'lib/nba/player.rb', line 57 attribute :jersey_number, Shale::Type::Integer |
#last_name ⇒ String
Returns the player’s last name
41 |
# File 'lib/nba/player.rb', line 41 attribute :last_name, Shale::Type::String |
#position ⇒ Position
Returns the player’s position
65 |
# File 'lib/nba/player.rb', line 65 attribute :position, Position |
#team ⇒ Team
Returns the player’s current team
129 |
# File 'lib/nba/player.rb', line 129 attribute :team, Team |
#weight ⇒ Integer
Returns the player’s weight
81 |
# File 'lib/nba/player.rb', line 81 attribute :weight, Shale::Type::Integer |
Instance Method Details
#center? ⇒ Boolean
Returns whether the player is a center
199 200 201 |
# File 'lib/nba/player.rb', line 199 def center? position_matches?("C", "Center") end |
#forward? ⇒ Boolean
Returns whether the player is a forward
189 190 191 |
# File 'lib/nba/player.rb', line 189 def forward? small_forward? || power_forward? || position_matches?("F", "Forward") end |
#guard? ⇒ Boolean
Returns whether the player is a guard
159 160 161 |
# File 'lib/nba/player.rb', line 159 def guard? point_guard? || shooting_guard? || position_matches?("G", "Guard") end |
#point_guard? ⇒ Boolean
Returns whether the player is a point guard
139 140 141 |
# File 'lib/nba/player.rb', line 139 def point_guard? position_matches?("PG", "Point Guard") end |
#power_forward? ⇒ Boolean
Returns whether the player is a power forward
179 180 181 |
# File 'lib/nba/player.rb', line 179 def power_forward? position_matches?("PF", "Power Forward") end |
#shooting_guard? ⇒ Boolean
Returns whether the player is a shooting guard
149 150 151 |
# File 'lib/nba/player.rb', line 149 def shooting_guard? position_matches?("SG", "Shooting Guard") end |
#small_forward? ⇒ Boolean
Returns whether the player is a small forward
169 170 171 |
# File 'lib/nba/player.rb', line 169 def small_forward? position_matches?("SF", "Small Forward") end |