Class: TF2LineParser::Events::PositionReport

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

Instance Attribute Summary collapse

Attributes inherited from Event

#airshot, #cap_name, #cap_number, #customkill, #healing, #item, #length, #message, #method, #role, #score, #target, #team, #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, name, uid, steam_id, team, position) ⇒ PositionReport

Returns a new instance of PositionReport.



16
17
18
19
20
# File 'lib/tf2_line_parser/events/position_report.rb', line 16

def initialize(time, name, uid, steam_id, team, position)
  @time = parse_time(time)
  @player = Player.new(name, uid, steam_id, team)
  @position = position
end

Instance Attribute Details

#playerObject (readonly)

Returns the value of attribute player.



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

def player
  @player
end

#positionObject (readonly)

Returns the value of attribute position.



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

def position
  @position
end

#timeObject (readonly)

Returns the value of attribute time.



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

def time
  @time
end

Class Method Details

.attributesObject



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

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

.regexObject



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

def self.regex
  @regex ||= /#{regex_time} #{regex_player} position_report \(position "(?'position'[^"]+)"\)/.freeze
end