class Fusuma::Plugin::Parsers::Parser

Parser change record and tag in event Inherite this base class

Public Instance Methods

parse(event) click to toggle source

Parse Event and convert Record and Tag if `#parse_record` return nil, this method will return original event @param event [Event] @return [Event]

# File lib/fusuma/plugin/parsers/parser.rb, line 15
def parse(event)
  return event if event.tag != source

  new_record = parse_record(event.record)
  return event if new_record.nil?

  event.record = new_record
  event.tag = tag
  event
end
parse_record(_record) click to toggle source

parse Record object @param _record [Record] @return [Record, nil]

# File lib/fusuma/plugin/parsers/parser.rb, line 39
def parse_record(_record)
  nil
end
source() click to toggle source

Set source for tag from config.yml. DEFAULT_SOURCE is defined in each Parser plugins.

# File lib/fusuma/plugin/parsers/parser.rb, line 28
def source
  @source ||= config_params(:source) || self.class.const_get('DEFAULT_SOURCE')
end
tag() click to toggle source
# File lib/fusuma/plugin/parsers/parser.rb, line 32
def tag
  @tag ||= self.class.name.split('::').last.underscore
end