Class: TF2LineParser::Events::Event
- Inherits:
-
Object
- Object
- TF2LineParser::Events::Event
- Defined in:
- lib/tf2_line_parser/events/event.rb
Direct Known Subclasses
CaptureBlock, ChargeDeployed, Chat, ConsoleSay, Damage, Heal, MedicDeath, PVPEvent, PlayerActionEvent, PointCapture, RoundEventWithVariables, RoundEventWithoutVariables, Score, Unknown
Instance Attribute Summary collapse
-
#airshot ⇒ Object
Returns the value of attribute airshot.
-
#cap_name ⇒ Object
Returns the value of attribute cap_name.
-
#cap_number ⇒ Object
Returns the value of attribute cap_number.
-
#customkill ⇒ Object
Returns the value of attribute customkill.
-
#healing ⇒ Object
Returns the value of attribute healing.
-
#item ⇒ Object
Returns the value of attribute item.
-
#length ⇒ Object
Returns the value of attribute length.
-
#message ⇒ Object
Returns the value of attribute message.
-
#method ⇒ Object
Returns the value of attribute method.
-
#player ⇒ Object
Returns the value of attribute player.
-
#role ⇒ Object
Returns the value of attribute role.
-
#score ⇒ Object
Returns the value of attribute score.
-
#target ⇒ Object
Returns the value of attribute target.
-
#team ⇒ Object
Returns the value of attribute team.
-
#time ⇒ Object
Returns the value of attribute time.
-
#type ⇒ Object
Returns the value of attribute type.
-
#ubercharge ⇒ Object
Returns the value of attribute ubercharge.
-
#unknown ⇒ Object
Returns the value of attribute unknown.
-
#value ⇒ Object
Returns the value of attribute value.
-
#weapon ⇒ Object
Returns the value of attribute weapon.
Class Method Summary collapse
- .regex_cap ⇒ Object
- .regex_console ⇒ Object
- .regex_message ⇒ Object
- .regex_player ⇒ Object
- .regex_results(matched_line) ⇒ Object
- .regex_target ⇒ Object
- .regex_time ⇒ Object
- .time_format ⇒ Object
- .types ⇒ Object
Instance Method Summary collapse
Instance Attribute Details
#airshot ⇒ Object
Returns the value of attribute airshot.
10 11 12 |
# File 'lib/tf2_line_parser/events/event.rb', line 10 def airshot @airshot end |
#cap_name ⇒ Object
Returns the value of attribute cap_name.
8 9 10 |
# File 'lib/tf2_line_parser/events/event.rb', line 8 def cap_name @cap_name end |
#cap_number ⇒ Object
Returns the value of attribute cap_number.
8 9 10 |
# File 'lib/tf2_line_parser/events/event.rb', line 8 def cap_number @cap_number end |
#customkill ⇒ Object
Returns the value of attribute customkill.
10 11 12 |
# File 'lib/tf2_line_parser/events/event.rb', line 10 def customkill @customkill end |
#healing ⇒ Object
Returns the value of attribute healing.
10 11 12 |
# File 'lib/tf2_line_parser/events/event.rb', line 10 def healing @healing end |
#item ⇒ Object
Returns the value of attribute item.
9 10 11 |
# File 'lib/tf2_line_parser/events/event.rb', line 9 def item @item end |
#length ⇒ Object
Returns the value of attribute length.
9 10 11 |
# File 'lib/tf2_line_parser/events/event.rb', line 9 def length @length end |
#message ⇒ Object
Returns the value of attribute message.
8 9 10 |
# File 'lib/tf2_line_parser/events/event.rb', line 8 def @message end |
#method ⇒ Object
Returns the value of attribute method.
9 10 11 |
# File 'lib/tf2_line_parser/events/event.rb', line 9 def method @method end |
#player ⇒ Object
Returns the value of attribute player.
10 11 12 |
# File 'lib/tf2_line_parser/events/event.rb', line 10 def player @player end |
#role ⇒ Object
Returns the value of attribute role.
9 10 11 |
# File 'lib/tf2_line_parser/events/event.rb', line 9 def role @role end |
#score ⇒ Object
Returns the value of attribute score.
9 10 11 |
# File 'lib/tf2_line_parser/events/event.rb', line 9 def score @score end |
#target ⇒ Object
Returns the value of attribute target.
10 11 12 |
# File 'lib/tf2_line_parser/events/event.rb', line 10 def target @target end |
#team ⇒ Object
Returns the value of attribute team.
9 10 11 |
# File 'lib/tf2_line_parser/events/event.rb', line 9 def team @team end |
#time ⇒ Object
Returns the value of attribute time.
8 9 10 |
# File 'lib/tf2_line_parser/events/event.rb', line 8 def time @time end |
#type ⇒ Object
Returns the value of attribute type.
8 9 10 |
# File 'lib/tf2_line_parser/events/event.rb', line 8 def type @type end |
#ubercharge ⇒ Object
Returns the value of attribute ubercharge.
10 11 12 |
# File 'lib/tf2_line_parser/events/event.rb', line 10 def ubercharge @ubercharge end |
#unknown ⇒ Object
Returns the value of attribute unknown.
8 9 10 |
# File 'lib/tf2_line_parser/events/event.rb', line 8 def unknown @unknown end |
#value ⇒ Object
Returns the value of attribute value.
9 10 11 |
# File 'lib/tf2_line_parser/events/event.rb', line 9 def value @value end |
#weapon ⇒ Object
Returns the value of attribute weapon.
10 11 12 |
# File 'lib/tf2_line_parser/events/event.rb', line 10 def weapon @weapon end |
Class Method Details
.regex_cap ⇒ Object
29 30 31 |
# File 'lib/tf2_line_parser/events/event.rb', line 29 def self.regex_cap @regex_cap ||= '\(cp "(?\'cp_number\'\d+)"\) \(cpname "(?\'cp_name\'.\w*)'.freeze end |
.regex_console ⇒ Object
33 34 35 |
# File 'lib/tf2_line_parser/events/event.rb', line 33 def self.regex_console @regex_console ||= '"Console<0><Console><Console>"'.freeze end |
.regex_message ⇒ Object
37 38 39 |
# File 'lib/tf2_line_parser/events/event.rb', line 37 def self. @regex_message ||= '"(?\'message\'.*)"'.freeze end |
.regex_player ⇒ Object
21 22 23 |
# File 'lib/tf2_line_parser/events/event.rb', line 21 def self.regex_player @regex_player ||= '"(?\'player_nick\'.+)<(?\'player_uid\'\d+)><(?\'player_steamid\'(\[\S+\]|STEAM_\S+))><(?\'player_team\'Red|Blue|Spectator)>"'.freeze end |
.regex_results(matched_line) ⇒ Object
49 50 51 52 53 |
# File 'lib/tf2_line_parser/events/event.rb', line 49 def self.regex_results(matched_line) attributes.collect do |attribute| matched_line[attribute] end end |
.regex_target ⇒ Object
25 26 27 |
# File 'lib/tf2_line_parser/events/event.rb', line 25 def self.regex_target @regex_target ||= '"(?\'target_nick\'.+)<(?\'target_uid\'\d+)><(?\'target_steamid\'(\[\S+\]|STEAM_\S+))><(?\'target_team\'Red|Blue)>"'.freeze end |
.regex_time ⇒ Object
17 18 19 |
# File 'lib/tf2_line_parser/events/event.rb', line 17 def self.regex_time @regex_time ||= 'L (?\'time\'.*):'.freeze end |
.time_format ⇒ Object
13 14 15 |
# File 'lib/tf2_line_parser/events/event.rb', line 13 def self.time_format @time_format ||= '%m/%d/%Y - %T'.freeze end |
.types ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/tf2_line_parser/events/event.rb', line 41 def self.types #ordered by how common the messages are @types ||= [Damage, Heal, PickupItem, Assist, Kill, CaptureBlock, PointCapture, ChargeDeployed, MedicDeath, RoleChange, Spawn, Airshot, HeadshotDamage, Suicide, Say, TeamSay, Domination, Revenge, RoundWin, CurrentScore, RoundLength, RoundStart, ConsoleSay, MatchEnd, FinalScore, RoundStalemate, Unknown].freeze end |
Instance Method Details
#parse_time(time_string) ⇒ Object
55 56 57 |
# File 'lib/tf2_line_parser/events/event.rb', line 55 def parse_time(time_string) Time.strptime(time_string, Event.time_format) end |