Class: Arachni::Component::Options::Bool
- Inherits:
-
Base
show all
- Defined in:
- lib/arachni/component/options/bool.rb
Overview
Constant Summary
collapse
- TRUE_REGEX =
/^(y|yes|t|1|true|on)$/i
- VALID_REGEXP =
/^(y|yes|n|no|t|f|0|1|true|false|on)$/i
Instance Attribute Summary
Attributes inherited from Base
#default, #description, #name, #value
Instance Method Summary
collapse
Methods inherited from Base
#==, #effective_value, #for_component, from_rpc_data, #hash, #initialize, #missing_value?, #required?, #to_h, #to_rpc_data
Instance Method Details
#false? ⇒ Boolean
30
31
32
|
# File 'lib/arachni/component/options/bool.rb', line 30
def false?
!true?
end
|
#normalize ⇒ Object
22
23
24
|
# File 'lib/arachni/component/options/bool.rb', line 22
def normalize
effective_value.to_s =~ TRUE_REGEX
end
|
#true? ⇒ Boolean
26
27
28
|
# File 'lib/arachni/component/options/bool.rb', line 26
def true?
normalize
end
|
34
35
36
|
# File 'lib/arachni/component/options/bool.rb', line 34
def type
:bool
end
|
#valid? ⇒ Boolean
17
18
19
20
|
# File 'lib/arachni/component/options/bool.rb', line 17
def valid?
return false if !super
effective_value.to_s.match( VALID_REGEXP )
end
|