Class: TF2LineParser::Events::PointCapture
- Defined in:
- lib/tf2_line_parser/events/point_capture.rb
Constant Summary collapse
- CAPPERS_REGEX =
/\(player\d+\s+"(?<player_section>[^"]*<[^>]*><[^>]*><[^>]*>)"\)/
Instance Attribute Summary collapse
-
#cappers ⇒ Object
readonly
Returns the value of attribute cappers.
Attributes inherited from Event
#airshot, #cap_name, #cap_number, #customkill, #healing, #item, #length, #message, #method, #player, #role, #score, #target, #team, #time, #type, #ubercharge, #unknown, #value, #weapon
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(time, team, cap_number, cap_name, _numcappers, cappers_section) ⇒ PointCapture
constructor
A new instance of PointCapture.
Methods inherited from Event
parse_player_section, parse_target_section, #parse_time, regex_cap, regex_console, regex_message, regex_player, regex_results, regex_target, regex_time, time_format, types
Constructor Details
#initialize(time, team, cap_number, cap_name, _numcappers, cappers_section) ⇒ PointCapture
Returns a new instance of PointCapture.
18 19 20 21 22 23 24 |
# File 'lib/tf2_line_parser/events/point_capture.rb', line 18 def initialize(time, team, cap_number, cap_name, _numcappers, cappers_section) @time = parse_time(time) @team = team @cap_number = cap_number @cap_name = cap_name @cappers = parse_cappers(cappers_section) end |
Instance Attribute Details
#cappers ⇒ Object (readonly)
Returns the value of attribute cappers.
8 9 10 |
# File 'lib/tf2_line_parser/events/point_capture.rb', line 8 def cappers @cappers end |
Class Method Details
.attributes ⇒ Object
14 15 16 |
# File 'lib/tf2_line_parser/events/point_capture.rb', line 14 def self.attributes @attributes ||= %i[time team cp_number cp_name numcappers cappers_section] end |
.regex ⇒ Object
10 11 12 |
# File 'lib/tf2_line_parser/events/point_capture.rb', line 10 def self.regex @regex ||= /#{regex_time} Team "(?'team'Red|Blue)" triggered "pointcaptured" \(cp "(?'cp_number'\d+)"\) \(cpname "(?'cp_name'[^"]*)"\) \(numcappers "(?'numcappers'\d+)"\)(?'cappers_section'.*)/.freeze end |