Class: Dressmaker::Configuration::FileRule::Pattern

Inherits:
Object
  • Object
show all
Defined in:
lib/dressmaker/configuration/file_rule.rb

Instance Method Summary collapse

Constructor Details

#initialize(pattern, &action) ⇒ Pattern

Returns a new instance of Pattern.



23
24
25
26
# File 'lib/dressmaker/configuration/file_rule.rb', line 23

def initialize(pattern, &action)
  @pattern = pattern
  @action = action
end

Instance Method Details

#matches?(base, target) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/dressmaker/configuration/file_rule.rb', line 28

def matches?(base, target)
  File.file?(File.join(base, target)) and File.fnmatch(pattern, File.join(base, target))
end