Class: RMuh::RPT::Log::Parsers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/rmuh/rpt/log/parsers/base.rb

Overview

This is the base RPT parser class. This does nothing but return each line as a Hash within an Array. There is no metadata extracted, it’s a literal copy and paste of the provided log line. This class is primarily used as an example class to be used for subclassing of your own parser

Direct Known Subclasses

UnitedOperationsLog, UnitedOperationsRPT

Instance Method Summary collapse

Constructor Details

#initialize(_opts = {}) ⇒ Base

Returns a new instance of Base.



13
14
# File 'lib/rmuh/rpt/log/parsers/base.rb', line 13

def initialize(_opts = {})
end

Instance Method Details

#parse(loglines) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/rmuh/rpt/log/parsers/base.rb', line 16

def parse(loglines)
  fail(
    ArgumentError, 'argument 1 must be an Array object'
  ) unless loglines.is_a?(Array)

  loglines.map { |line| { type: :log, message: line } }
end