Module: Serf::Message

Extended by:
ActiveSupport::Concern
Included in:
Serf::Messages::CaughtExceptionEvent, Serf::Messages::MessageAcceptedEvent
Defined in:
lib/serf/message.rb

Overview

A module to represent a message that we’re transporting over the wire. This is mainly for commands and events in ED-SOA. Optional, but useful for validations, etc.

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#kindObject



20
21
22
# File 'lib/serf/message.rb', line 20

def kind
  self.class.kind
end

#to_hashObject



24
25
26
# File 'lib/serf/message.rb', line 24

def to_hash
  attributes.merge kind: kind
end

#to_json(*args) ⇒ Object



32
33
34
# File 'lib/serf/message.rb', line 32

def to_json(*args)
  to_hash.to_json *args
end

#to_msgpackObject



28
29
30
# File 'lib/serf/message.rb', line 28

def to_msgpack
  to_hash.to_msgpack
end