Class: Takumi::Packet::Ushort

Inherits:
Object
  • Object
show all
Defined in:
lib/takumi/packet/ushort.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ushort) ⇒ Ushort

Returns a new instance of Ushort.



10
11
12
# File 'lib/takumi/packet/ushort.rb', line 10

def initialize(ushort)
  @ushort = ushort
end

Class Method Details

.decode(source) ⇒ Object



5
6
7
# File 'lib/takumi/packet/ushort.rb', line 5

def decode(source)
  return source[0..1].unpack("n"), 2
end

Instance Method Details

#to_sObject



14
15
16
# File 'lib/takumi/packet/ushort.rb', line 14

def to_s
  [@ushort].pack("n")
end