Class: Watobo::NTLM::Int16LE

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



347
348
349
350
# File 'lib/watobo/utils/ntlm.rb', line 347

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

Instance Method Details

#parse(str, offset = 0) ⇒ Object



351
352
353
354
355
356
357
358
# File 'lib/watobo/utils/ntlm.rb', line 351

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



360
361
362
# File 'lib/watobo/utils/ntlm.rb', line 360

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