Class: Arachni::Component::Options::Enum
- Inherits:
-
Base
show all
- Defined in:
- lib/arachni/component/options/enum.rb
Overview
Instance Attribute Summary
Attributes inherited from Base
#default, #enums, #name
Instance Method Summary
collapse
Methods inherited from Base
#==, #empty_required_value?, #initialize, #required?, #to_h, #type?
Instance Method Details
42
43
44
45
46
47
|
# File 'lib/arachni/component/options/enum.rb', line 42
def desc
if self.enums
str = self.enums.join( ', ' )
end
"#{self.desc_string || @desc || ''} (accepted: #{str})"
end
|
#desc=(value) ⇒ Object
37
38
39
40
|
# File 'lib/arachni/component/options/enum.rb', line 37
def desc=( value )
self.desc_string = value
self.desc
end
|
#normalize(value = self.value) ⇒ Object
32
33
34
35
|
# File 'lib/arachni/component/options/enum.rb', line 32
def normalize( value = self.value )
return nil if !self.valid?( value )
value.to_s
end
|
23
24
25
|
# File 'lib/arachni/component/options/enum.rb', line 23
def type
'enum'
end
|
#valid?(value = self.value) ⇒ Boolean
27
28
29
30
|
# File 'lib/arachni/component/options/enum.rb', line 27
def valid?( value = self.value )
return false if empty_required_value?( value )
value && self.enums.include?( value.to_s )
end
|