Class: QuakeLogParser::Game

Inherits:
Object
  • Object
show all
Defined in:
lib/quake-log-parser/game.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/quake-log-parser/game.rb', line 3

def id
  @id
end

#killsObject

Returns the value of attribute kills.



3
4
5
# File 'lib/quake-log-parser/game.rb', line 3

def kills
  @kills
end

#means_of_deathObject

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

#playersObject

Returns the value of attribute players.



3
4
5
# File 'lib/quake-log-parser/game.rb', line 3

def players
  @players
end

#total_killsObject

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_killObject



17
18
19
# File 'lib/quake-log-parser/game.rb', line 17

def add_total_kill
  @total_kills += 1
end