class WarningHandler

Handles warnings found when reading logs

Attributes

warning_info[R]
warnings[R]

Public Class Methods

new(warnings: []) click to toggle source
# File lib/log_parser/warning_handler.rb, line 9
def initialize(warnings: [])
  @warnings = warnings
end

Public Instance Methods

store_warning_info(warning_info: {}) click to toggle source
# File lib/log_parser/warning_handler.rb, line 13
def store_warning_info(warning_info: {})
  @warning_info = warning_info
  self
end
warnings_summary() click to toggle source
# File lib/log_parser/warning_handler.rb, line 18
def warnings_summary
  summary = {}
  warning_info.each do |type, info|
    summary[type] = {}
    summary[type][:name] = info[:name]
    summary[type][:important] = info[:important]
    summary[type][:warnings] = @warnings
                               .filter { |warning| warning[:type] == type }
                               .map { |warning| warning[:message] }
  end
  summary
end