Class: QuakeLogParser::Player
- Inherits:
-
Object
- Object
- QuakeLogParser::Player
- Defined in:
- lib/quake-log-parser/player.rb
Instance Attribute Summary collapse
-
#kills ⇒ Object
Returns the value of attribute kills.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #add_kill ⇒ Object
-
#initialize(name:) ⇒ Player
constructor
A new instance of Player.
- #subtract_kill ⇒ Object
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
#kills ⇒ Object
Returns the value of attribute kills.
3 4 5 |
# File 'lib/quake-log-parser/player.rb', line 3 def kills @kills end |
#name ⇒ Object
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_kill ⇒ Object
10 11 12 |
# File 'lib/quake-log-parser/player.rb', line 10 def add_kill @kills += 1 end |
#subtract_kill ⇒ Object
14 15 16 17 18 |
# File 'lib/quake-log-parser/player.rb', line 14 def subtract_kill return if @kills.zero? @kills -= 1 end |