Class: Middleman::WebP::PathnameMatcher
- Inherits:
-
Object
- Object
- Middleman::WebP::PathnameMatcher
- Defined in:
- lib/middleman-webp/pathname_matcher.rb
Instance Method Summary collapse
-
#initialize(pattern = '**/*') ⇒ PathnameMatcher
constructor
Initializes matcher with given pattern.
-
#matches?(path) ⇒ Boolean
Checks given file against pattern.
Constructor Details
#initialize(pattern = '**/*') ⇒ PathnameMatcher
Initializes matcher with given pattern.
pattern - Pattern to match pathnames against to. May be
string, glob, prog or regex.
8 9 10 |
# File 'lib/middleman-webp/pathname_matcher.rb', line 8 def initialize(pattern = '**/*') @pattern = pattern end |
Instance Method Details
#matches?(path) ⇒ Boolean
Checks given file against pattern.
file - File, Pathname or String
15 16 17 18 19 |
# File 'lib/middleman-webp/pathname_matcher.rb', line 15 def matches?(path) return false if path.nil? send match_method, Pathname.new(path) end |