File: message.rb

package info (click to toggle)
ruby-riemann-client 1.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 228 kB
  • sloc: ruby: 1,271; makefile: 2
file content (18 lines) | stat: -rw-r--r-- 383 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

module Riemann
  class Message
    include Beefcake::Message

    optional :ok, :bool, 2
    optional :error, :string, 3
    repeated :states, State, 4
    optional :query, Query, 5
    repeated :events, Event, 6

    def encode_with_length
      encoded_string = encode.to_s
      [encoded_string.length].pack('N') << encoded_string
    end
  end
end