Class: Net::NTLM::String
Instance Attribute Summary
Attributes inherited from Field
Instance Method Summary collapse
-
#initialize(opts) ⇒ String
constructor
A new instance of String.
- #parse(str, offset = 0) ⇒ Object
- #serialize ⇒ Object
- #value=(val) ⇒ Object
Methods inherited from Field
Constructor Details
#initialize(opts) ⇒ String
Returns a new instance of String.
5 6 7 8 |
# File 'lib/net/ntlm/string.rb', line 5 def initialize(opts) super(opts) @size = opts[:size] end |
Instance Method Details
#parse(str, offset = 0) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/net/ntlm/string.rb', line 10 def parse(str, offset=0) if @active and str.size >= offset + @size @value = str[offset, @size] @size else 0 end end |
#serialize ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/net/ntlm/string.rb', line 19 def serialize if @active @value.to_s else "" end end |
#value=(val) ⇒ Object
27 28 29 30 31 |
# File 'lib/net/ntlm/string.rb', line 27 def value=(val) @value = val @size = @value.nil? ? 0 : @value.size @active = (@size > 0) end |