Sha256: de07059de3418d49f2090b1167b13c93d7fb68cf3e9fde5bcc374f9eb4f243ee

Contents?: true

Size: 1012 Bytes

Versions: 6

Compression:

Stored size: 1012 Bytes

Contents

=begin
    Copyright 2010-2015 Tasos Laskos <tasos.laskos@arachni-scanner.com>

    This file is part of the Arachni Framework project and is subject to
    redistribution and commercial restrictions. Please see the Arachni Framework
    web site for more information on licensing and terms of use.
=end

# MultipleChoice option.
#
# @author Tasos "Zapotek" Laskos <tasos.laskos@arachni-scanner.com>
class Arachni::Component::Options::MultipleChoice < Arachni::Component::Options::Base

    # The list of potential valid values
    attr_accessor :choices

    def initialize( name, options = {} )
        options  = options.dup
        @choices = [options.delete(:choices)].flatten.compact.map(&:to_s)
        super
    end

    def normalize
        super.to_s
    end

    def valid?
        return false if !super
        choices.include?( effective_value )
    end

    def description
        "#{@description} (accepted: #{choices.join( ', ' )})"
    end

    def type
        :multiple_choice
    end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
arachni-1.3.2 lib/arachni/component/options/multiple_choice.rb
arachni-1.3.1 lib/arachni/component/options/multiple_choice.rb
arachni-1.3 lib/arachni/component/options/multiple_choice.rb
arachni-1.2.1 lib/arachni/component/options/multiple_choice.rb
arachni-1.2 lib/arachni/component/options/multiple_choice.rb
arachni-1.1 lib/arachni/component/options/multiple_choice.rb