Class: Beowulf::Type::Uint16
- Inherits:
-
Serializer
- Object
- Serializer
- Beowulf::Type::Uint16
- Defined in:
- lib/beowulf/type/u_int16.rb
Instance Method Summary collapse
-
#initialize(value) ⇒ Uint16
constructor
A new instance of Uint16.
- #to_bytes ⇒ Object
- #to_s ⇒ Object
Methods included from Utils
#debug, #error, #extract_signatures, #hexlify, #pakArr, #pakC, #pakHash, #pakI, #pakL!, #pakPubKey, #pakQ, #pakS, #pakStr, #pakc, #pakq, #paks, #send_log, #unhexlify, #varint, #warning
Constructor Details
#initialize(value) ⇒ Uint16
Returns a new instance of Uint16.
4 5 6 |
# File 'lib/beowulf/type/u_int16.rb', line 4 def initialize(value) super(:u_int_16, value.to_i) end |
Instance Method Details
#to_bytes ⇒ Object
8 9 10 |
# File 'lib/beowulf/type/u_int16.rb', line 8 def to_bytes [@value].pack('S') end |
#to_s ⇒ Object
12 13 14 |
# File 'lib/beowulf/type/u_int16.rb', line 12 def to_s @value.to_s end |