Sha256: 5e3bbe7263a452ff9bf9a1089934b048859c47ebab45edc14b96cd1bd3deffbb

Contents?: true

Size: 571 Bytes

Versions: 2

Compression:

Stored size: 571 Bytes

Contents

class FluQ::Format::Msgpack < FluQ::Format::Base

  # @see FluQ::Format::Base.to_event
  def self.to_event(raw)
    case raw
    when Hash
      FluQ::Event.new(raw)
    else
      logger.warn "buffer contained invalid event #{raw.inspect}"
      nil
    end
  end

  # Msgpack initializer
  # @see FluQ::Format::Base#initialize
  def initialize(*)
    super
    @buffer = MessagePack::Unpacker.new
  end

  protected

    # @see FluQ::Format::Base#parse_each
    def parse_each(chunk, &block)
      @buffer.feed_each(chunk, &block)
    end

end if defined?(MessagePack)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fluq-0.8.1 lib/fluq/format/msgpack.rb
fluq-0.8.0 lib/fluq/format/msgpack.rb