Class: QuakeLogParser::Player

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:) ⇒ Player

Returns a new instance of Player.



5
6
7
8
# File 'lib/quake-log-parser/player.rb', line 5

def initialize(name:)
  @name = name
  @kills = 0
end

Instance Attribute Details

#killsObject

Returns the value of attribute kills.



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

def kills
  @kills
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

Instance Method Details

#add_killObject



10
11
12
# File 'lib/quake-log-parser/player.rb', line 10

def add_kill
  @kills += 1
end

#subtract_killObject



14
15
16
17
18
# File 'lib/quake-log-parser/player.rb', line 14

def subtract_kill
  return if @kills.zero?

  @kills -= 1
end