Sha256: 2f21cb62727d21e190477f085324be18f485eee0be57abed3e339fa67d3dc216

Contents?: true

Size: 1001 Bytes

Versions: 2

Compression:

Stored size: 1001 Bytes

Contents

=begin
    Copyright 2010-2017 Sarosys LLC <http://www.sarosys.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

2 entries across 2 versions & 1 rubygems

Version Path
arachni-1.5.1 lib/arachni/component/options/multiple_choice.rb
arachni-1.5 lib/arachni/component/options/multiple_choice.rb