Class: Overlook::Csgo::Demo::Parser

Inherits:
Object
  • Object
show all
Includes:
Wisper::Publisher
Defined in:
lib/overlook/csgo/demo/parser.rb

Constant Summary collapse

Exception =
Class.new(StandardError)
InvalidDemo =
Class.new(Exception)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(io, parser_config) ⇒ Parser

Returns a new instance of Parser.



16
17
18
19
20
21
# File 'lib/overlook/csgo/demo/parser.rb', line 16

def initialize(io, parser_config)
  @parser_config = parser_config
  @reader  = ByteReader.new(io)
  @header  = nil
  @descriptors = {}
end

Instance Attribute Details

#descriptorsObject

Returns the value of attribute descriptors.



14
15
16
# File 'lib/overlook/csgo/demo/parser.rb', line 14

def descriptors
  @descriptors
end

#parser_configObject (readonly)

Returns the value of attribute parser_config.



13
14
15
# File 'lib/overlook/csgo/demo/parser.rb', line 13

def parser_config
  @parser_config
end

#readerObject (readonly)

Returns the value of attribute reader.



12
13
14
# File 'lib/overlook/csgo/demo/parser.rb', line 12

def reader
  @reader
end

Instance Method Details

#emit(event, data = {}) ⇒ Object



29
30
31
# File 'lib/overlook/csgo/demo/parser.rb', line 29

def emit(event, data = {})
  broadcast(event.to_sym, data)
end

#parseObject



23
24
25
26
27
# File 'lib/overlook/csgo/demo/parser.rb', line 23

def parse
  header
  packets
  done
end