Class: Arachni::OptBool
Overview
Constant Summary
collapse
- TrueRegex =
/^(y|yes|t|1|true|on)$/i
Instance Attribute Summary
Attributes inherited from OptBase
#default, #desc, #enums, #name, #owner, #required
Instance Method Summary
collapse
Methods inherited from OptBase
#empty_required_value?, #initialize, #required?, #to_h, #type?
Instance Method Details
#is_false?(value) ⇒ Boolean
218
219
220
|
# File 'lib/arachni/component_options.rb', line 218
def is_false?(value)
return !is_true?(value)
end
|
#is_true?(value) ⇒ Boolean
214
215
216
|
# File 'lib/arachni/component_options.rb', line 214
def is_true?(value)
return normalize(value)
end
|
#normalize(value) ⇒ Object
206
207
208
209
210
211
212
|
# File 'lib/arachni/component_options.rb', line 206
def normalize(value)
if(value.nil? or value.to_s.match(TrueRegex).nil?)
false
else
true
end
end
|
190
191
192
|
# File 'lib/arachni/component_options.rb', line 190
def type
return 'bool'
end
|
#valid?(value) ⇒ Boolean
194
195
196
197
198
199
200
201
202
203
204
|
# File 'lib/arachni/component_options.rb', line 194
def valid?(value)
return false if empty_required_value?(value)
if ((value != nil and
(value.to_s.empty? == false) and
(value.to_s.match(/^(y|yes|n|no|t|f|0|1|true|false|on)$/i) == nil)))
return false
end
true
end
|