Class: Net::NTLM::Int16LE

Inherits:
Field
  • Object
show all
Defined in:
lib/watobo/external/ntlm/ntlm.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.



323
324
325
326
# File 'lib/watobo/external/ntlm/ntlm.rb', line 323

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

Instance Method Details

#parse(str, offset = 0) ⇒ Object



327
328
329
330
331
332
333
334
# File 'lib/watobo/external/ntlm/ntlm.rb', line 327

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



336
337
338
# File 'lib/watobo/external/ntlm/ntlm.rb', line 336

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