Class: Stargate::Marshal::Payload
- Inherits:
-
Struct
- Object
- Struct
- Stargate::Marshal::Payload
- Includes:
- Serialization
- Defined in:
- lib/stargate/marshal/payload.rb
Overview
Internal: We need some packaging to move stuff from one machine to another. We have to know what types are coming in. We distinguish four base types:
-
Simple type (string, number, booleans),
-
Symbol,
-
List (Array),
-
Hash
Later, we can pack any other type that has been registered for exchange.
Constant Summary collapse
- LIST =
:a- SIMPLE =
:b- SYMBOL =
:s- HASH =
:h
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
Methods included from Serialization
#bencode, #to_json, #to_msgpack
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data
14 15 16 |
# File 'lib/stargate/marshal/payload.rb', line 14 def data @data end |
#type ⇒ Object
Returns the value of attribute type
14 15 16 |
# File 'lib/stargate/marshal/payload.rb', line 14 def type @type end |
Instance Method Details
#inspect ⇒ Object
26 27 28 |
# File 'lib/stargate/marshal/payload.rb', line 26 def inspect serialize.inspect end |
#serialize ⇒ Object
22 23 24 |
# File 'lib/stargate/marshal/payload.rb', line 22 def serialize [ type, data ] end |