Module: LogParser

Defined in:
lib/log_parser.rb,
lib/log_parser/version.rb

Overview

Stores version number

Constant Summary collapse

VERSION =
'0.1.1'

Class Method Summary collapse

Class Method Details

.parseObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/log_parser.rb', line 9

def self.parse
  @options = OptionHandler.new.options

  log_reader = LogReader.new(
    options: { file_list: @options[:file_list],
               path_validation: @options[:path_validation],
               ip_validation: @options[:ip_validation],
               log_remove: @options[:log_remove] }
  ).load_logs

  parser = Parser.new(log_reader: log_reader,
                      quiet: @options[:quiet],
                      verbose: @options[:verbose])
  parser.count_views

  output_processor = OutputProcessor.new(parser: parser, options: @options)
  puts output_processor.output_to_display

  return unless @options[:output_file]

  output_processor.write_to_file(format: @options[:output_format])
end