Module: Arborist::EventAPI

Extended by:
Loggability
Defined in:
lib/arborist/event_api.rb

Class Method Summary collapse

Class Method Details

.decode(msg) ⇒ Object

Decode and return the identifier and payload from the specified msg (a CZTop::Message).



27
28
29
30
31
# File 'lib/arborist/event_api.rb', line 27

def self::decode( msg )
  identifier, encoded_payload = msg.to_a
  payload = MessagePack.unpack( encoded_payload )
  return identifier, payload
end

.encode(identifier, payload) ⇒ Object

Encode an event with the specified identifier and payload as a CZTop::Message and return it.



20
21
22
23
# File 'lib/arborist/event_api.rb', line 20

def self::encode( identifier, payload )
  encoded_payload = MessagePack.pack( payload )
  return CZTop::Message.new([ identifier, encoded_payload ])
end