Class: Sanford::Protocol::PackedHeader
- Inherits:
-
Struct
- Object
- Struct
- Sanford::Protocol::PackedHeader
- Defined in:
- lib/sanford-protocol.rb
Instance Attribute Summary collapse
-
#bytes ⇒ Object
Returns the value of attribute bytes.
-
#directive ⇒ Object
Returns the value of attribute directive.
Instance Method Summary collapse
Instance Attribute Details
#bytes ⇒ Object
Returns the value of attribute bytes
35 36 37 |
# File 'lib/sanford-protocol.rb', line 35 def bytes @bytes end |
#directive ⇒ Object
Returns the value of attribute directive
35 36 37 |
# File 'lib/sanford-protocol.rb', line 35 def directive @directive end |
Instance Method Details
#decode(binary) ⇒ Object
37 |
# File 'lib/sanford-protocol.rb', line 37 def decode(binary); binary.to_s.unpack(directive).first; end |
#encode(data) ⇒ Object
36 |
# File 'lib/sanford-protocol.rb', line 36 def encode(data); [*data].pack(directive); end |