Sha256: 1cb43804571f91cdc9f0cc7226e4f37f9031785ab98ddb96abf59ee87d1a05fb

Contents?: true

Size: 785 Bytes

Versions: 5

Compression:

Stored size: 785 Bytes

Contents

=begin
    Copyright 2010-2022 Ecsypno <http://www.ecsypno.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

module Arachni
module Support

# @author Tasos "Zapotek" Laskos <tasos.laskos@arachni-scanner.com>
class Glob

    def self.to_regexp( glob )
        escaped = Regexp.escape( glob ).gsub( '\*', '.*?' )
        Regexp.new( "^#{escaped}$", Regexp::IGNORECASE )
    end

    attr_reader :regexp

    def initialize( glob )
        @regexp = self.class.to_regexp( glob )
    end

    def =~( str )
        !!(str =~ @regexp)
    end
    alias :matches? :=~
    alias :match? :matches?

end

end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
arachni-1.6.1.3 lib/arachni/support/glob.rb
arachni-1.6.1.2 lib/arachni/support/glob.rb
arachni-1.6.1.1 lib/arachni/support/glob.rb
arachni-1.6.1 lib/arachni/support/glob.rb
arachni-1.6.0 lib/arachni/support/glob.rb