Class: Net::NTLM::FieldSet
- Inherits:
-
Object
- Object
- Net::NTLM::FieldSet
show all
- Defined in:
- lib/net/ntlm/field_set.rb
Overview
base class of data structure
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of FieldSet.
87
88
89
|
# File 'lib/net/ntlm/field_set.rb', line 87
def initialize
@alist = self.class.prototypes.map{ |n, t, o| [n, t.new(o)] }
end
|
Class Method Details
.int16LE(name, opts) ⇒ Object
20
21
22
|
# File 'lib/net/ntlm/field_set.rb', line 20
def int16LE(name, opts)
add_field(name, Net::NTLM::Int16LE, opts)
end
|
.int32LE(name, opts) ⇒ Object
28
29
30
|
# File 'lib/net/ntlm/field_set.rb', line 28
def int32LE(name, opts)
add_field(name, Net::NTLM::Int32LE, opts)
end
|
.int64LE(name, opts) ⇒ Object
36
37
38
|
# File 'lib/net/ntlm/field_set.rb', line 36
def int64LE(name, opts)
add_field(name, Net::NTLM::Int64LE, opts)
end
|
.names ⇒ Object
52
53
54
55
|
# File 'lib/net/ntlm/field_set.rb', line 52
def names
return [] if @proto.nil?
@proto.map{|n, t, o| n}
end
|
.opts ⇒ Object
62
63
64
65
|
# File 'lib/net/ntlm/field_set.rb', line 62
def opts
return [] if @proto.nil?
@proto.map{|n, t, o| o}
end
|
.prototypes ⇒ Object
48
49
50
|
# File 'lib/net/ntlm/field_set.rb', line 48
def prototypes
@proto
end
|
.security_buffer(name, opts) ⇒ Object
44
45
46
|
# File 'lib/net/ntlm/field_set.rb', line 44
def security_buffer(name, opts)
add_field(name, Net::NTLM::SecurityBuffer, opts)
end
|
.string(name, opts) ⇒ Object
12
13
14
|
# File 'lib/net/ntlm/field_set.rb', line 12
def string(name, opts)
add_field(name, Net::NTLM::String, opts)
end
|
.types ⇒ Object
57
58
59
60
|
# File 'lib/net/ntlm/field_set.rb', line 57
def types
return [] if @proto.nil?
@proto.map{|n, t, o| t}
end
|
Instance Method Details
#[](name) ⇒ Object
103
104
105
106
107
|
# File 'lib/net/ntlm/field_set.rb', line 103
def [](name)
a = @alist.assoc(name.to_s.intern)
raise ArgumentError, "no such field: #{name}" unless a
a[1]
end
|
#[]=(name, val) ⇒ Object
109
110
111
112
113
|
# File 'lib/net/ntlm/field_set.rb', line 109
def []=(name, val)
a = @alist.assoc(name.to_s.intern)
raise ArgumentError, "no such field: #{name}" unless a
a[1] = val
end
|
#disable(name) ⇒ Object
119
120
121
|
# File 'lib/net/ntlm/field_set.rb', line 119
def disable(name)
self[name].active = false
end
|
#enable(name) ⇒ Object
115
116
117
|
# File 'lib/net/ntlm/field_set.rb', line 115
def enable(name)
self[name].active = true
end
|
#parse(str, offset = 0) ⇒ Object
95
96
97
|
# File 'lib/net/ntlm/field_set.rb', line 95
def parse(str, offset=0)
@alist.inject(offset){|cur, a| cur += a[1].parse(str, cur)}
end
|
#serialize ⇒ Object
91
92
93
|
# File 'lib/net/ntlm/field_set.rb', line 91
def serialize
@alist.map{|n, f| f.serialize }.join
end
|
#size ⇒ Object
99
100
101
|
# File 'lib/net/ntlm/field_set.rb', line 99
def size
@alist.inject(0){|sum, a| sum += a[1].size}
end
|