Sha256: 3aa430b7a76d5a3ed071d2d4438d95b5ef9f8450ec103d4301ca6626aa504857

Contents?: true

Size: 570 Bytes

Versions: 48

Compression:

Stored size: 570 Bytes

Contents

require 'beefcake'
require 'kurchatov/riemann/event'

# monkey patch
module Beefcake::Message
  def initialize(attrs={})
    attrs ||= {}
    fields.values.each do |fld|
      self[fld.name] = attrs[fld.name]
    end
  end
end

module Kurchatov
  module Riemann
    class Message
      include Beefcake::Message

      optional :ok, :bool, 2
      optional :error, :string, 3
      repeated :events, Event, 6

      def encode_with_length
        buffer = ''
        encoded = encode buffer
        "#{[encoded.length].pack('N')}#{encoded}"
      end

    end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
kurchatov-0.2.5 lib/kurchatov/riemann/message.rb
kurchatov-0.2.4 lib/kurchatov/riemann/message.rb
kurchatov-0.2.3 lib/kurchatov/riemann/message.rb
kurchatov-0.2.2 lib/kurchatov/riemann/message.rb
kurchatov-0.2.1 lib/kurchatov/riemann/message.rb
kurchatov-0.2.0 lib/kurchatov/riemann/message.rb
kurchatov-0.1.8 lib/kurchatov/riemann/message.rb
kurchatov-0.1.7 lib/kurchatov/riemann/message.rb
kurchatov-0.1.6 lib/kurchatov/riemann/message.rb
kurchatov-0.1.5 lib/kurchatov/riemann/message.rb
kurchatov-0.1.4 lib/kurchatov/riemann/message.rb
kurchatov-0.1.3 lib/kurchatov/riemann/message.rb
kurchatov-0.1.2 lib/kurchatov/riemann/message.rb
kurchatov-0.1.1 lib/kurchatov/riemann/message.rb
kurchatov-0.1.0 lib/kurchatov/riemann/message.rb
kurchatov-0.0.9 lib/kurchatov/riemann/message.rb
kurchatov-0.0.8.pre.3 lib/kurchatov/riemann/message.rb
kurchatov-0.0.7.pre.4 lib/kurchatov/riemann/message.rb
kurchatov-0.0.8.pre.2 lib/kurchatov/riemann/message.rb
kurchatov-0.0.8.pre.1 lib/kurchatov/riemann/message.rb