Class: TF2LineParser::Events::Chat

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

Direct Known Subclasses

Say, TeamSay

Instance Attribute Summary

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

Methods inherited from Event

parse_player_section, parse_target_section, #parse_time, regex_cap, regex_console, regex_message, regex_player, regex_target, regex_time, time_format, types

Constructor Details

#initialize(time, player_name, player_uid, player_steam_id, player_team, message) ⇒ Chat

Returns a new instance of Chat.



6
7
8
9
10
# File 'lib/tf2_line_parser/events/chat.rb', line 6

def initialize(time, player_name, player_uid, player_steam_id, player_team, message)
  @time = parse_time(time)
  @player = Player.new(player_name, player_uid, player_steam_id, player_team)
  @message = message
end

Class Method Details

.attributesObject



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

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

.regex_results(matched_line) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/tf2_line_parser/events/chat.rb', line 16

def self.regex_results(matched_line)
  time = matched_line['time']
  player_section = matched_line['player_section']
  message = matched_line['message']

  # Parse player section
  player_name, player_uid, player_steamid, player_team = parse_player_section(player_section)

  [time, player_name, player_uid, player_steamid, player_team, message]
end