Class: QuakeLogParser::Game
- Inherits:
-
Object
- Object
- QuakeLogParser::Game
- Defined in:
- lib/quake-log-parser/game.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#kills ⇒ Object
Returns the value of attribute kills.
-
#means_of_death ⇒ Object
Returns the value of attribute means_of_death.
-
#players ⇒ Object
Returns the value of attribute players.
-
#total_kills ⇒ Object
Returns the value of attribute total_kills.
Instance Method Summary collapse
- #add_kill(kill) ⇒ Object
- #add_means_of_death(mean) ⇒ Object
- #add_player(player) ⇒ Object
- #add_total_kill ⇒ Object
-
#initialize(id:) ⇒ Game
constructor
A new instance of Game.
Constructor Details
#initialize(id:) ⇒ Game
Returns a new instance of Game.
5 6 7 8 9 10 11 |
# File 'lib/quake-log-parser/game.rb', line 5 def initialize(id:) @id = id @total_kills = 0 @players = {} @means_of_death = {} @kills = [] end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/quake-log-parser/game.rb', line 3 def id @id end |
#kills ⇒ Object
Returns the value of attribute kills.
3 4 5 |
# File 'lib/quake-log-parser/game.rb', line 3 def kills @kills end |
#means_of_death ⇒ Object
Returns the value of attribute means_of_death.
3 4 5 |
# File 'lib/quake-log-parser/game.rb', line 3 def means_of_death @means_of_death end |
#players ⇒ Object
Returns the value of attribute players.
3 4 5 |
# File 'lib/quake-log-parser/game.rb', line 3 def players @players end |
#total_kills ⇒ Object
Returns the value of attribute total_kills.
3 4 5 |
# File 'lib/quake-log-parser/game.rb', line 3 def total_kills @total_kills end |
Instance Method Details
#add_kill(kill) ⇒ Object
26 27 28 |
# File 'lib/quake-log-parser/game.rb', line 26 def add_kill(kill) @kills << kill end |
#add_means_of_death(mean) ⇒ Object
21 22 23 24 |
# File 'lib/quake-log-parser/game.rb', line 21 def add_means_of_death(mean) @means_of_death[mean] ||= 0 @means_of_death[mean] += 1 end |
#add_player(player) ⇒ Object
13 14 15 |
# File 'lib/quake-log-parser/game.rb', line 13 def add_player(player) @players[player.name] = player end |
#add_total_kill ⇒ Object
17 18 19 |
# File 'lib/quake-log-parser/game.rb', line 17 def add_total_kill @total_kills += 1 end |