Class: RMuh::RPT::Log::Parsers::UnitedOperationsLog

Inherits:
Base
  • Object
show all
Extended by:
Util::UnitedOperations, Util::UnitedOperationsLog
Includes:
Util::UnitedOperations, Util::UnitedOperationsLog
Defined in:
lib/rmuh/rpt/log/parsers/unitedoperationslog.rb

Overview

TODO: UnitedOperationsLog Class Documentation

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Util::UnitedOperations

__check_match_arg, __guid_add_data, __guid_data_base, __line_modifiers, __modifiers, __parse_nearby_players, add_guid!, guid_keys, m_to_h, validate_bool_opt, validate_timezone, zulu!

Constructor Details

#initialize(opts = {}) ⇒ UnitedOperationsLog

Returns a new instance of UnitedOperationsLog.



30
31
32
33
34
35
# File 'lib/rmuh/rpt/log/parsers/unitedoperationslog.rb', line 30

def initialize(opts = {})
  self.class.validate_opts(opts)
  @include_chat = opts[:chat].nil? ? false : opts[:chat]
  @to_zulu = opts[:to_zulu].nil? ? true : opts[:to_zulu]
  @timezone = opts[:timezone].nil? ? UO_TZ : opts[:timezone]
end

Class Method Details

.validate_opts(opts) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/rmuh/rpt/log/parsers/unitedoperationslog.rb', line 21

def self.validate_opts(opts)
  fail(
    ArgumentError, 'arg 1 should be an instance of Hash'
  ) unless opts.is_a?(Hash)
  validate_bool_opt(opts, :to_zulu)
  validate_timezone(opts)
  validate_bool_opt(opts, :chat)
end

Instance Method Details

#parse(loglines) ⇒ Object



37
38
39
40
41
42
# File 'lib/rmuh/rpt/log/parsers/unitedoperationslog.rb', line 37

def parse(loglines)
  unless loglines.is_a?(StringIO)
    fail ArgumentError, 'arg 1 must be a StringIO object'
  end
  regex_matches(loglines)
end