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.4.7 lib/kurchatov/riemann/message.rb
kurchatov-0.4.6 lib/kurchatov/riemann/message.rb
kurchatov-0.4.5 lib/kurchatov/riemann/message.rb
kurchatov-0.4.4 lib/kurchatov/riemann/message.rb
kurchatov-0.4.3 lib/kurchatov/riemann/message.rb
kurchatov-0.4.2 lib/kurchatov/riemann/message.rb
kurchatov-0.4.1 lib/kurchatov/riemann/message.rb
kurchatov-0.3.8 lib/kurchatov/riemann/message.rb
kurchatov-0.3.7 lib/kurchatov/riemann/message.rb
kurchatov-0.3.6 lib/kurchatov/riemann/message.rb
kurchatov-0.3.5 lib/kurchatov/riemann/message.rb
kurchatov-0.3.4 lib/kurchatov/riemann/message.rb
kurchatov-0.3.3 lib/kurchatov/riemann/message.rb
kurchatov-0.3.2 lib/kurchatov/riemann/message.rb
kurchatov-0.3.1 lib/kurchatov/riemann/message.rb
kurchatov-0.3.0 lib/kurchatov/riemann/message.rb
kurchatov-0.2.9 lib/kurchatov/riemann/message.rb
kurchatov-0.2.8 lib/kurchatov/riemann/message.rb
kurchatov-0.2.7 lib/kurchatov/riemann/message.rb
kurchatov-0.2.6 lib/kurchatov/riemann/message.rb