Class: Arachni::Component::Options::MultipleChoice
- Defined in:
- lib/arachni/component/options/multiple_choice.rb
Overview
MultipleChoice option.
Instance Attribute Summary collapse
-
#choices ⇒ Object
The list of potential valid values.
Attributes inherited from Base
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(name, options = {}) ⇒ MultipleChoice
constructor
A new instance of MultipleChoice.
- #normalize ⇒ Object
- #type ⇒ Object
- #valid? ⇒ Boolean
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
Returns a new instance of MultipleChoice.
17 18 19 20 21 |
# File 'lib/arachni/component/options/multiple_choice.rb', line 17 def initialize( name, = {} ) = .dup @choices = [.delete(:choices)].flatten.compact.map(&:to_s) super end |
Instance Attribute Details
#choices ⇒ Object
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 |
#type ⇒ Object
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 |