Class: Net::NTLM::Int32LE

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



5
6
7
8
# File 'lib/net/ntlm/int32_le.rb', line 5

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

Instance Method Details

#parse(str, offset = 0) ⇒ Object



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

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



19
20
21
# File 'lib/net/ntlm/int32_le.rb', line 19

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