Class: Quaker3::Kill
- Inherits:
-
Object
- Object
- Quaker3::Kill
- Defined in:
- lib/quaker3/kill.rb
Overview
Represents the Kill model extract from Quake 3 Arena log file
Constant Summary collapse
- REGEX_KILL_DATA =
/(?<=Kill:).*/.freeze
- REGEX_KILLER =
/(.*)(?=killed)/.freeze
- REGEX_KILLED =
/(?<=killed)(.*)(?=by)/.freeze
- REGEX_KILL_MODE =
/(?<=by).*/.freeze
- DEFAULT_NAME =
'(player)'
Instance Attribute Summary collapse
-
#killed ⇒ Object
readonly
Returns the value of attribute killed.
-
#killer ⇒ Object
readonly
Returns the value of attribute killer.
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
Instance Method Summary collapse
-
#initialize(line) ⇒ Kill
constructor
A new instance of Kill.
-
#to_h ⇒ Hash
Generate a hash that represent’s a Kill model.
Constructor Details
#initialize(line) ⇒ Kill
Returns a new instance of Kill.
16 17 18 |
# File 'lib/quaker3/kill.rb', line 16 def initialize(line) parse! line end |
Instance Attribute Details
#killed ⇒ Object (readonly)
Returns the value of attribute killed.
7 8 9 |
# File 'lib/quaker3/kill.rb', line 7 def killed @killed end |
#killer ⇒ Object (readonly)
Returns the value of attribute killer.
7 8 9 |
# File 'lib/quaker3/kill.rb', line 7 def killer @killer end |
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
7 8 9 |
# File 'lib/quaker3/kill.rb', line 7 def mode @mode end |
Instance Method Details
#to_h ⇒ Hash
Generate a hash that represent’s a Kill model
22 23 24 25 26 27 28 |
# File 'lib/quaker3/kill.rb', line 22 def to_h { 'killer' => @killer, 'killed' => @killed, 'mode' => @mode } end |