Sha256: aea88e1234cfeb3d7bd19fc11ede0ecd14d12c6a7904375d4585f11e859fab10

Contents?: true

Size: 859 Bytes

Versions: 2

Compression:

Stored size: 859 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

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

    TRUE_REGEX   = /^(y|yes|t|1|true|on)$/i
    VALID_REGEXP = /^(y|yes|n|no|t|f|0|1|true|false|on)$/i

    def valid?
        return false if !super
        effective_value.to_s.match( VALID_REGEXP )
    end

    def normalize
        effective_value.to_s =~ TRUE_REGEX
    end

    def true?
        normalize
    end

    def false?
        !true?
    end

    def type
        :bool
    end

end

Version data entries

2 entries across 2 versions & 1 rubygems

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