Class: Glob

Inherits:
Object
  • Object
show all
Defined in:
lib/w-stdlib/glob.rb

Instance Method Summary collapse

Constructor Details

#initialize(pat) ⇒ Glob

Returns a new instance of Glob.



6
7
8
# File 'lib/w-stdlib/glob.rb', line 6

def initialize(pat)
  @r = pat.regexp_encode.gsub('\*', '.*').to_regexp
end

Instance Method Details

#match?(s) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/w-stdlib/glob.rb', line 10

def match?(s)
  @r.match?(s)
end