Class: LogAuditor::Parser

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reader:, formatter:, presenter:) ⇒ Parser

Returns a new instance of Parser.



6
7
8
9
10
# File 'lib/log_auditor/parser.rb', line 6

def initialize(reader:, formatter:, presenter:)
  @reader = reader
  @formatter = formatter
  @presenter = presenter
end

Instance Attribute Details

#formatterObject (readonly)

Returns the value of attribute formatter.



4
5
6
# File 'lib/log_auditor/parser.rb', line 4

def formatter
  @formatter
end

#presenterObject (readonly)

Returns the value of attribute presenter.



4
5
6
# File 'lib/log_auditor/parser.rb', line 4

def presenter
  @presenter
end

#readerObject (readonly)

Returns the value of attribute reader.



4
5
6
# File 'lib/log_auditor/parser.rb', line 4

def reader
  @reader
end

Instance Method Details

#parse!Object



12
13
14
15
16
# File 'lib/log_auditor/parser.rb', line 12

def parse!
  raw_data = reader.read!
  formatted_data = formatter.new(raw_data).format!
  presenter.new(formatted_data).present!
end