Class: Dressmaker::Configuration::DirectoryRule::Pattern
- Inherits:
-
Dressmaker::Configuration::DirectoryRule
- Object
- Rule
- Dressmaker::Configuration::DirectoryRule
- Dressmaker::Configuration::DirectoryRule::Pattern
- Defined in:
- lib/dressmaker/configuration/directory_rule.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
Attributes inherited from Dressmaker::Configuration::DirectoryRule
Attributes inherited from Rule
Instance Method Summary collapse
-
#initialize(pattern, &action) ⇒ Pattern
constructor
A new instance of Pattern.
- #matches?(base, target) ⇒ Boolean
Methods inherited from Dressmaker::Configuration::DirectoryRule
Methods inherited from Rule
Constructor Details
#initialize(pattern, &action) ⇒ Pattern
Returns a new instance of Pattern.
20 21 22 23 |
# File 'lib/dressmaker/configuration/directory_rule.rb', line 20 def initialize(pattern, &action) @pattern = pattern @action = action end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
18 19 20 |
# File 'lib/dressmaker/configuration/directory_rule.rb', line 18 def action @action end |
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
18 19 20 |
# File 'lib/dressmaker/configuration/directory_rule.rb', line 18 def pattern @pattern end |
Instance Method Details
#matches?(base, target) ⇒ Boolean
25 26 27 |
# File 'lib/dressmaker/configuration/directory_rule.rb', line 25 def matches?(base, target) File.directory?(File.join(base, target)) && File.fnmatch(pattern, target) end |