Class: FluQ::Format::Base

Inherits:
Object
  • Object
show all
Extended by:
Mixins::Loggable
Includes:
Mixins::Loggable
Defined in:
lib/fluq/format/base.rb

Direct Known Subclasses

Lines, Msgpack

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Mixins::Loggable

logger

Constructor Details

#initialize(options = {}) ⇒ Base

This method is abstract.

initializer

Returns a new instance of Base.

Parameters:

  • options (Hash) (defaults to: {})

    format-specific options



13
14
15
# File 'lib/fluq/format/base.rb', line 13

def initialize(options = {})
  @options = options
end

Class Method Details

.to_event(raw) ⇒ FluQ::Event

This method is abstract.

converter

Returns event.

Parameters:

  • raw (String)

    event string

Returns:



8
9
# File 'lib/fluq/format/base.rb', line 8

def self.to_event(raw)
end

Instance Method Details

#parse(data) ⇒ Array<FluQ::Event>

This method is abstract.

parse data, return events

Returns events.

Parameters:

  • data (String)

Returns:



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fluq/format/base.rb', line 20

def parse(data)
  events = []
  parse_each(data) do |raw|
    if event = self.class.to_event(raw)
      events.push(event)
      true
    else
      false
    end
  end
  events
end