Crystal bindings: removing a useless CBOR function.
parent
1c850be4cf
commit
6a912202e4
|
@ -1,4 +1,5 @@
|
||||||
require "cbor"
|
require "cbor"
|
||||||
|
require "./main.cr"
|
||||||
|
|
||||||
# IPC::CBOR is the root class for all exchanged messages (using CBOR).
|
# IPC::CBOR is the root class for all exchanged messages (using CBOR).
|
||||||
# IPC::CBOR inherited classes have a common 'type' class attribute,
|
# IPC::CBOR inherited classes have a common 'type' class attribute,
|
||||||
|
@ -42,19 +43,6 @@ class IPC
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# CAUTION: Only use this method on an Array(IPC::CBOR.class)
|
|
||||||
class Array(T)
|
|
||||||
def parse_ipc_cbor(message : IPC::Message) : IPC::CBOR?
|
|
||||||
message_type = find &.type.==(message.utype)
|
|
||||||
|
|
||||||
if message_type.nil?
|
|
||||||
raise "invalid message type (#{message.utype})"
|
|
||||||
end
|
|
||||||
|
|
||||||
message_type.from_cbor message.payload
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# CAUTION: only use this method on an Array(IPC::CBOR.class).
|
# CAUTION: only use this method on an Array(IPC::CBOR.class).
|
||||||
class Array(T)
|
class Array(T)
|
||||||
def parse_ipc_cbor(message : IPCMessage::TypedMessage) : IPC::CBOR?
|
def parse_ipc_cbor(message : IPCMessage::TypedMessage) : IPC::CBOR?
|
||||||
|
|
Reference in New Issue