Class: EspnPub::Entities::Player
- Defined in:
- lib/espn_pub/entities/player.rb
Overview
Represents a player on a team.
Instance Attribute Summary collapse
-
#first_name ⇒ Object
readonly
Returns the value of attribute first_name.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#last_name ⇒ Object
readonly
Returns the value of attribute last_name.
-
#league ⇒ Object
readonly
Returns the value of attribute league.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#sport ⇒ Object
readonly
Returns the value of attribute sport.
-
#team_id ⇒ Object
readonly
Returns the value of attribute team_id.
Attributes inherited from Base
Instance Method Summary collapse
-
#full_name ⇒ String
Return the player’s full name.
-
#initialize(id:, sport:, league:, first_name: nil, last_name: nil, position: nil, team_id: nil) ⇒ Player
constructor
Initialize a Player entity.
Constructor Details
#initialize(id:, sport:, league:, first_name: nil, last_name: nil, position: nil, team_id: nil) ⇒ Player
Initialize a Player entity.
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/espn_pub/entities/player.rb', line 24 def initialize(id:, sport:, league:, first_name: nil, last_name: nil, position: nil, team_id: nil) @id = id @sport = sport @league = league @first_name = first_name @last_name = last_name @position = position @team_id = team_id super() end |
Instance Attribute Details
#first_name ⇒ Object (readonly)
Returns the value of attribute first_name.
7 8 9 |
# File 'lib/espn_pub/entities/player.rb', line 7 def first_name @first_name end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/espn_pub/entities/player.rb', line 7 def id @id end |
#last_name ⇒ Object (readonly)
Returns the value of attribute last_name.
7 8 9 |
# File 'lib/espn_pub/entities/player.rb', line 7 def last_name @last_name end |
#league ⇒ Object (readonly)
Returns the value of attribute league.
7 8 9 |
# File 'lib/espn_pub/entities/player.rb', line 7 def league @league end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
7 8 9 |
# File 'lib/espn_pub/entities/player.rb', line 7 def position @position end |
#sport ⇒ Object (readonly)
Returns the value of attribute sport.
7 8 9 |
# File 'lib/espn_pub/entities/player.rb', line 7 def sport @sport end |
#team_id ⇒ Object (readonly)
Returns the value of attribute team_id.
7 8 9 |
# File 'lib/espn_pub/entities/player.rb', line 7 def team_id @team_id end |
Instance Method Details
#full_name ⇒ String
Return the player’s full name.
38 39 40 |
# File 'lib/espn_pub/entities/player.rb', line 38 def full_name @full_name ||= first_name + ' ' + last_name end |