Class: Glob
- Inherits:
-
Object
- Object
- Glob
- Defined in:
- lib/w-stdlib/glob.rb
Instance Method Summary collapse
-
#initialize(pat) ⇒ Glob
constructor
A new instance of Glob.
- #match?(s) ⇒ Boolean
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
10 11 12 |
# File 'lib/w-stdlib/glob.rb', line 10 def match?(s) @r.match?(s) end |