Class: Net::NTLM::SecurityBuffer

Inherits:
Object
  • Object
show all
Defined in:
lib/watobo/external/ntlm/ntlm.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ SecurityBuffer

Returns a new instance of SecurityBuffer.



509
510
511
512
513
514
# File 'lib/watobo/external/ntlm/ntlm.rb', line 509

def initialize(opts)
  super()
  @value  = opts[:value]
  @active = opts[:active].nil? ? true : opts[:active]
  @size = 8
end

Instance Attribute Details

#activeObject

Returns the value of attribute active.



508
509
510
# File 'lib/watobo/external/ntlm/ntlm.rb', line 508

def active
  @active
end

Instance Method Details

#data_sizeObject



539
540
541
# File 'lib/watobo/external/ntlm/ntlm.rb', line 539

def data_size
  @active ? @value.size : 0
end

#parse(str, offset = 0) ⇒ Object



516
517
518
519
520
521
522
523
524
# File 'lib/watobo/external/ntlm/ntlm.rb', line 516

def parse(str, offset=0)
  if @active and str.size >= offset + @size
    super(str, offset)
    @value = str[self.offset, self.length]
    @size
  else
    0
  end
end

#serializeObject



526
527
528
# File 'lib/watobo/external/ntlm/ntlm.rb', line 526

def serialize
  super if @active
end

#valueObject



530
531
532
# File 'lib/watobo/external/ntlm/ntlm.rb', line 530

def value
  @value
end

#value=(val) ⇒ Object



534
535
536
537
# File 'lib/watobo/external/ntlm/ntlm.rb', line 534

def value=(val)
  @value = val
  self.length = self.allocated = val.size
end