Class: TF2LineParser::Events::PlayerActionEvent
- Defined in:
- lib/tf2_line_parser/events/player_action_event.rb
Direct Known Subclasses
JoinedTeam, PickupItem, RoleChange, ShotFired, ShotHit, Suicide
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
-
#initialize(time, player_name, player_uid, player_steam_id, player_team, item = self.class.item) ⇒ PlayerActionEvent
constructor
A new instance of PlayerActionEvent.
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, item = self.class.item) ⇒ PlayerActionEvent
Returns a new instance of PlayerActionEvent.
14 15 16 17 18 |
# File 'lib/tf2_line_parser/events/player_action_event.rb', line 14 def initialize(time, player_name, player_uid, player_steam_id, player_team, item = self.class.item) @time = parse_time(time) @player = Player.new(player_name, player_uid, player_steam_id, player_team) instance_variable_set("@#{self.class.item}", item) end |
Class Method Details
.attributes ⇒ Object
10 11 12 |
# File 'lib/tf2_line_parser/events/player_action_event.rb', line 10 def self.attributes @attributes ||= [:time, :player_section, :item] end |
.regex ⇒ Object
6 7 8 |
# File 'lib/tf2_line_parser/events/player_action_event.rb', line 6 def self.regex @regex ||= /#{regex_time} #{regex_player} #{action_text} #{regex_action}/.freeze end |