Class: Quaker3::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/quaker3/parser.rb

Overview

Converts the Quake 3 Arena log file into Game model

Author:

  • Renan Gigliotti

Constant Summary collapse

REGEX_COMMAND =
/^.{0,7}([a-z A-Z][^:]*)/.freeze
COMMAND_INIT_GAME =
'initgame'
COMMAND_SHUTDOWN =
'shutdowngame'
COMMAND_KILL =
'kill'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_path) ⇒ Parser

Initialize method to generate a list of games from Quake 3 Arena Server log file

Parameters:

  • file_path (String)

    the path of file



20
21
22
23
24
# File 'lib/quaker3/parser.rb', line 20

def initialize(file_path)
  @games = []
  @current_game = nil
  process file_path
end

Instance Attribute Details

#gamesGame (readonly)

List of Game model parsed from Quake 3 Arena Server log file

Returns:

  • (Game)

    list of games



11
12
13
# File 'lib/quaker3/parser.rb', line 11

def games
  @games
end