Class: TF2LineParser::Events::AirshotHeal

Inherits:
Heal
  • Object
show all
Defined in:
lib/tf2_line_parser/events/airshot_heal.rb

Instance Attribute Summary collapse

Attributes inherited from Event

#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

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, value, airshot) ⇒ AirshotHeal

Returns a new instance of AirshotHeal.



24
25
26
27
28
29
30
31
# File 'lib/tf2_line_parser/events/airshot_heal.rb', line 24

def initialize(time, player_name, player_uid, player_steam_id, player_team, target_name, target_uid, target_steam_id, target_team, value, airshot)
  @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)
  @value = value.to_i
  @healing = @value
  @airshot = (airshot.to_i == 1)
end

Instance Attribute Details

#airshotObject (readonly)

Returns the value of attribute airshot.



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

def airshot
  @airshot
end

Class Method Details

.attributesObject



20
21
22
# File 'lib/tf2_line_parser/events/airshot_heal.rb', line 20

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

.regexObject



8
9
10
# File 'lib/tf2_line_parser/events/airshot_heal.rb', line 8

def self.regex
  @regex ||= /#{regex_time} #{regex_player} triggered "healed" against #{regex_target} \(healing "(?'value'\d+)"\)#{regex_airshot}#{regex_height}/.freeze
end

.regex_airshotObject



12
13
14
# File 'lib/tf2_line_parser/events/airshot_heal.rb', line 12

def self.regex_airshot
  @regex_airshot ||= / \(airshot "(?'airshot'\w*)"\)/
end

.regex_heightObject



16
17
18
# File 'lib/tf2_line_parser/events/airshot_heal.rb', line 16

def self.regex_height
  @regex_height ||= /(?: \(height "(?'height'\d*)"\))?/
end