Class: Unified2::Payload
- Inherits:
-
Object
- Object
- Unified2::Payload
- Defined in:
- lib/unified2/payload.rb
Instance Attribute Summary collapse
-
#length ⇒ Object
Returns the value of attribute length.
-
#linktype ⇒ Object
Returns the value of attribute linktype.
Instance Method Summary collapse
- #blank? ⇒ Boolean
- #dump(options = {}) ⇒ Object
- #hex ⇒ Object
-
#initialize(payload = {}) ⇒ Payload
constructor
A new instance of Payload.
- #raw ⇒ Object
Constructor Details
#initialize(payload = {}) ⇒ Payload
Returns a new instance of Payload.
8 9 10 11 12 |
# File 'lib/unified2/payload.rb', line 8 def initialize(payload={}) @payload = payload[:payload] @length = payload[:packet_length].to_i @linktype = payload[:linktype] end |
Instance Attribute Details
#length ⇒ Object
Returns the value of attribute length.
6 7 8 |
# File 'lib/unified2/payload.rb', line 6 def length @length end |
#linktype ⇒ Object
Returns the value of attribute linktype.
6 7 8 |
# File 'lib/unified2/payload.rb', line 6 def linktype @linktype end |
Instance Method Details
#blank? ⇒ Boolean
14 15 16 17 |
# File 'lib/unified2/payload.rb', line 14 def blank? return true unless @payload false end |
#dump(options = {}) ⇒ Object
27 28 29 |
# File 'lib/unified2/payload.rb', line 27 def dump(={}) Hexdump.dump(@payload, ) end |
#hex ⇒ Object
23 24 25 |
# File 'lib/unified2/payload.rb', line 23 def hex @payload.to_s.unpack('H*') end |
#raw ⇒ Object
19 20 21 |
# File 'lib/unified2/payload.rb', line 19 def raw @payload.to_s end |