Class: Net::NTLM::Int16LE

Inherits:
Field
  • Object
show all
Defined in:
lib/net/ntlm/int16_le.rb

Instance Attribute Summary

Attributes inherited from Field

#active, #value

Instance Method Summary collapse

Methods inherited from Field

#size

Constructor Details

#initialize(opt) ⇒ Int16LE

Returns a new instance of Int16LE.



6
7
8
9
# File 'lib/net/ntlm/int16_le.rb', line 6

def initialize(opt)
  super(opt)
  @size = 2
end

Instance Method Details

#parse(str, offset = 0) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/net/ntlm/int16_le.rb', line 11

def parse(str, offset=0)
  if @active and str.size >= offset + @size
    @value = str[offset, @size].unpack("v")[0]
    @size
  else
    0
  end
end

#serializeObject



20
21
22
# File 'lib/net/ntlm/int16_le.rb', line 20

def serialize
  [@value].pack("v")
end