Class: Arachni::Support::Glob
Overview
Instance Attribute Summary collapse
-
#regexp ⇒ Object
readonly
Returns the value of attribute regexp.
Class Method Summary collapse
Instance Method Summary collapse
- #=~(str) ⇒ Object (also: #matches?)
-
#initialize(glob) ⇒ Glob
constructor
A new instance of Glob.
Constructor Details
#initialize(glob) ⇒ Glob
Returns a new instance of Glob.
22 23 24 |
# File 'lib/arachni/support/glob.rb', line 22 def initialize( glob ) @regexp = self.class.to_regexp( glob ) end |
Instance Attribute Details
#regexp ⇒ Object (readonly)
Returns the value of attribute regexp.
20 21 22 |
# File 'lib/arachni/support/glob.rb', line 20 def regexp @regexp end |
Class Method Details
.to_regexp(glob) ⇒ Object
15 16 17 18 |
# File 'lib/arachni/support/glob.rb', line 15 def self.to_regexp( glob ) escaped = Regexp.escape( glob ).gsub( '\*', '.*?' ) Regexp.new( "^#{escaped}$", Regexp::IGNORECASE ) end |
Instance Method Details
#=~(str) ⇒ Object Also known as: matches?
26 27 28 |
# File 'lib/arachni/support/glob.rb', line 26 def =~( str ) !!(str =~ @regexp) end |