31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/sub_zero/message/parser.rb', line 31
def from_source source
type = source.shift
if type.index ':'
type, subtype = type.split(':')
end
rid = source.shift
verb = source.shift
if verb.index ':'
verb, status = verb.split(':')
end
payload = MessagePack.unpack(source.shift).with_indifferent_access
unless source.empty?
routing_info = MessagePack.unpack(source.shift).with_indifferent_access
end
new type: type, rid: rid, verb: verb, payload: payload,
subtype: subtype, status: status, routing_info: routing_info
end
|