Class: TorigoyaKit::Protocol::Frame
- Inherits:
-
Object
- Object
- TorigoyaKit::Protocol::Frame
- Defined in:
- lib/torigoya_kit/protocol.rb
Instance Attribute Summary collapse
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#raw_object ⇒ Object
readonly
Returns the value of attribute raw_object.
Instance Method Summary collapse
- #get_object ⇒ Object
-
#initialize(kind, buffer) ⇒ Frame
constructor
A new instance of Frame.
Constructor Details
#initialize(kind, buffer) ⇒ Frame
Returns a new instance of Frame.
60 61 62 63 |
# File 'lib/torigoya_kit/protocol.rb', line 60 def initialize(kind, buffer) @kind = kind @raw_object = MessagePack.unpack(buffer) end |
Instance Attribute Details
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
64 65 66 |
# File 'lib/torigoya_kit/protocol.rb', line 64 def kind @kind end |
#raw_object ⇒ Object (readonly)
Returns the value of attribute raw_object.
64 65 66 |
# File 'lib/torigoya_kit/protocol.rb', line 64 def raw_object @raw_object end |
Instance Method Details
#get_object ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/torigoya_kit/protocol.rb', line 66 def get_object case @kind when MessageKindOutputs return StreamOutputResult.from_hash(@raw_object) when MessageKindResult return StreamExecutedResult.from_hash(@raw_object) when MessageKindSystemError return StreamSystemError.new(@raw_object) when MessageKindExit return StreamExit.new(@raw_object) when MessageKindSystemResult return StreamSystemResult.new(@raw_object) else raise "Protocol :: Result kind(#{kind}) is not supported by clitnt side" end end |