Class: TF2LineParser::Events::PlayerExtinguished

Inherits:
Event
  • Object
show all
Defined in:
lib/tf2_line_parser/events/player_extinguished.rb

Instance Attribute Summary collapse

Attributes inherited from Event

#airshot, #cap_name, #cap_number, #customkill, #healing, #item, #length, #message, #method, #role, #score, #team, #type, #ubercharge, #unknown, #value

Class Method Summary collapse

Instance Method Summary collapse

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, player_name, player_uid, player_steam_id, player_team, target_name, target_uid, target_steam_id, target_team, weapon) ⇒ PlayerExtinguished

Returns a new instance of PlayerExtinguished.



22
23
24
25
26
27
# File 'lib/tf2_line_parser/events/player_extinguished.rb', line 22

def initialize(time, player_name, player_uid, player_steam_id, player_team, target_name, target_uid, target_steam_id, target_team, weapon)
  @time = parse_time(time)
  @player = Player.new(player_name, player_uid, player_steam_id, player_team)
  @target = Player.new(target_name, target_uid, target_steam_id, target_team)
  @weapon = weapon
end

Instance Attribute Details

#playerObject (readonly)

Returns the value of attribute player.



4
5
6
# File 'lib/tf2_line_parser/events/player_extinguished.rb', line 4

def player
  @player
end

#targetObject (readonly)

Returns the value of attribute target.



4
5
6
# File 'lib/tf2_line_parser/events/player_extinguished.rb', line 4

def target
  @target
end

#timeObject (readonly)

Returns the value of attribute time.



4
5
6
# File 'lib/tf2_line_parser/events/player_extinguished.rb', line 4

def time
  @time
end

#weaponObject (readonly)

Returns the value of attribute weapon.



4
5
6
# File 'lib/tf2_line_parser/events/player_extinguished.rb', line 4

def weapon
  @weapon
end

Class Method Details

.attributesObject



18
19
20
# File 'lib/tf2_line_parser/events/player_extinguished.rb', line 18

def self.attributes
  @attributes ||= %i[time player_section target_section weapon]
end

.regexObject



6
7
8
# File 'lib/tf2_line_parser/events/player_extinguished.rb', line 6

def self.regex
  @regex ||= /#{regex_time} #{regex_player} triggered "player_extinguished" against #{regex_target} with #{regex_weapon}#{regex_positions}?/.freeze
end

.regex_positionsObject



14
15
16
# File 'lib/tf2_line_parser/events/player_extinguished.rb', line 14

def self.regex_positions
  @regex_positions ||= / \(attacker_position "[^"]+"\) \(victim_position "[^"]+"\)/
end

.regex_weaponObject



10
11
12
# File 'lib/tf2_line_parser/events/player_extinguished.rb', line 10

def self.regex_weapon
  @regex_weapon ||= '"(?\'weapon\'[^"]+)"'
end