Class: Torkify::Log::Parser

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stream) ⇒ Parser

Returns a new instance of Parser.



11
12
13
14
# File 'lib/torkify/log/parser.rb', line 11

def initialize(stream)
  @reader = LogReader.new stream
  self.errors = []
end

Instance Attribute Details

#errorsObject

Returns the value of attribute errors.



9
10
11
# File 'lib/torkify/log/parser.rb', line 9

def errors
  @errors
end

Instance Method Details

#parseObject



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/torkify/log/parser.rb', line 16

def parse
  parse_log
  self
rescue EOFError
  # noop
  self
rescue Exception => e
  # Tag all exceptions with Torkify::Error
  e.extend Error
  raise e
end