Class: FootStats::Live::Player
- Inherits:
-
Object
- Object
- FootStats::Live::Player
- Defined in:
- lib/foot_stats/live_player.rb
Instance Attribute Summary collapse
-
#minute ⇒ Object
readonly
Returns the value of attribute minute.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#period ⇒ Object
readonly
Returns the value of attribute period.
-
#source_id ⇒ Object
readonly
Returns the value of attribute source_id.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#substituted ⇒ Object
readonly
Returns the value of attribute substituted.
-
#was_substituted ⇒ Object
(also: #substituted?)
readonly
Returns the value of attribute was_substituted.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params) ⇒ Player
constructor
A new instance of Player.
Constructor Details
#initialize(params) ⇒ Player
Returns a new instance of Player.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/foot_stats/live_player.rb', line 6 def initialize(params) @source_id = params["@IdJogador"].to_i @name = params["@Jogador"] @status = params["@Status"] @was_substituted = params["@Substituto"] != '' @period = params["@Periodo"] @minute = params["@Minuto"].to_i @substituted = params["@Substituto"] if @was_substituted end |
Instance Attribute Details
#minute ⇒ Object (readonly)
Returns the value of attribute minute.
4 5 6 |
# File 'lib/foot_stats/live_player.rb', line 4 def minute @minute end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/foot_stats/live_player.rb', line 4 def name @name end |
#period ⇒ Object (readonly)
Returns the value of attribute period.
4 5 6 |
# File 'lib/foot_stats/live_player.rb', line 4 def period @period end |
#source_id ⇒ Object (readonly)
Returns the value of attribute source_id.
4 5 6 |
# File 'lib/foot_stats/live_player.rb', line 4 def source_id @source_id end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
4 5 6 |
# File 'lib/foot_stats/live_player.rb', line 4 def status @status end |
#substituted ⇒ Object (readonly)
Returns the value of attribute substituted.
4 5 6 |
# File 'lib/foot_stats/live_player.rb', line 4 def substituted @substituted end |
#was_substituted ⇒ Object (readonly) Also known as: substituted?
Returns the value of attribute was_substituted.
4 5 6 |
# File 'lib/foot_stats/live_player.rb', line 4 def was_substituted @was_substituted end |
Class Method Details
.diff(players, old_players_ids) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/foot_stats/live_player.rb', line 19 def self.diff(players, old_players_ids) new_players_ids = players.map &:source_id { added: (new_players_ids - old_players_ids), removed: (old_players_ids - new_players_ids) } end |