Class: Watobo::NTLM::Int32LE

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) ⇒ Int32LE

Returns a new instance of Int32LE.



375
376
377
378
# File 'lib/watobo/utils/ntlm.rb', line 375

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

Instance Method Details

#parse(str, offset = 0) ⇒ Object



380
381
382
383
384
385
386
387
# File 'lib/watobo/utils/ntlm.rb', line 380

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

#serializeObject



389
390
391
# File 'lib/watobo/utils/ntlm.rb', line 389

def serialize
  [@value].pack("V") if @active
end