Class: Arachni::Component::Options::MultipleChoice
- Inherits:
-
Base
- Object
- Base
- Arachni::Component::Options::MultipleChoice
show all
- Defined in:
- lib/arachni/component/options/multiple_choice.rb
Overview
Instance Attribute Summary collapse
Attributes inherited from Base
#default, #name, #value
Instance Method Summary
collapse
Methods inherited from Base
#==, #effective_value, #for_component, from_rpc_data, #hash, #missing_value?, #required?, #to_h, #to_rpc_data
Constructor Details
#initialize(name, options = {}) ⇒ MultipleChoice
17
18
19
20
21
|
# File 'lib/arachni/component/options/multiple_choice.rb', line 17
def initialize( name, options = {} )
options = options.dup
@choices = [options.delete(:choices)].flatten.compact.map(&:to_s)
super
end
|
Instance Attribute Details
The list of potential valid values
15
16
17
|
# File 'lib/arachni/component/options/multiple_choice.rb', line 15
def choices
@choices
end
|
Instance Method Details
#description ⇒ Object
32
33
34
|
# File 'lib/arachni/component/options/multiple_choice.rb', line 32
def description
"#{@description} (accepted: #{choices.join( ', ' )})"
end
|
#normalize ⇒ Object
23
24
25
|
# File 'lib/arachni/component/options/multiple_choice.rb', line 23
def normalize
super.to_s
end
|
36
37
38
|
# File 'lib/arachni/component/options/multiple_choice.rb', line 36
def type
:multiple_choice
end
|
#valid? ⇒ Boolean
27
28
29
30
|
# File 'lib/arachni/component/options/multiple_choice.rb', line 27
def valid?
return false if !super
choices.include?( effective_value )
end
|