Class: Radiator::Type::Uint16

Inherits:
Serializer show all
Defined in:
lib/radiator/type/u_int16.rb

Overview

Instance Method Summary collapse

Methods included from Utils

#debug, #error, #extract_signatures, #hexlify, #pakArr, #pakC, #pakHash, #pakI, #pakL!, #pakS, #pakStr, #pakc, #paks, #send_log, #unhexlify, #varint, #warning

Constructor Details

#initialize(value) ⇒ Uint16

Returns a new instance of Uint16.



6
7
8
# File 'lib/radiator/type/u_int16.rb', line 6

def initialize(value)
  super(:u_int_16, value.to_i)
end

Instance Method Details

#to_bytesObject



10
11
12
# File 'lib/radiator/type/u_int16.rb', line 10

def to_bytes
  [@value].pack('S')
end

#to_sObject



14
15
16
# File 'lib/radiator/type/u_int16.rb', line 14

def to_s
  @value.to_s
end