Method: Invoker::IPC::Message::Serialization#attributes

Defined in:
lib/invoker/ipc/message.rb

#attributesObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/invoker/ipc/message.rb', line 33

def attributes
  message_attribute_keys = message_attributes || []
  message_attribute_keys.reduce({}) do |mem, obj|
    value = send(obj)
    if value.is_a?(Array)
      mem[obj] = serialize_array(value)
    elsif value.is_a?(Hash)
      mem[obj] = serialize_hash(value)
    else
      mem[obj] = value.respond_to?(:as_json) ? value.as_json : encode_as_utf(value)
    end
    mem
  end
end