Class: Nanoc::RuleDSL::Rule Private
- Inherits:
-
Object
- Object
- Nanoc::RuleDSL::Rule
- Includes:
- Core::ContractsSupport
- Defined in:
- lib/nanoc/rule_dsl/rule.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Direct Known Subclasses
Instance Attribute Summary collapse
- #pattern ⇒ Object readonly private
- #rep_name ⇒ Object readonly private
Instance Method Summary collapse
- #applicable_to?(item) ⇒ Boolean private
-
#initialize(pattern, rep_name, block) ⇒ Rule
constructor
private
A new instance of Rule.
- #matches(identifier) ⇒ Object private
Constructor Details
#initialize(pattern, rep_name, block) ⇒ Rule
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Rule.
14 15 16 17 18 |
# File 'lib/nanoc/rule_dsl/rule.rb', line 14 def initialize(pattern, rep_name, block) @pattern = pattern @rep_name = rep_name.to_sym @block = block end |
Instance Attribute Details
#pattern ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/nanoc/rule_dsl/rule.rb', line 11 def pattern @pattern end |
#rep_name ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
8 9 10 |
# File 'lib/nanoc/rule_dsl/rule.rb', line 8 def rep_name @rep_name end |
Instance Method Details
#applicable_to?(item) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
21 22 23 |
# File 'lib/nanoc/rule_dsl/rule.rb', line 21 def applicable_to?(item) @pattern.match?(item.identifier) end |
#matches(identifier) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/nanoc/rule_dsl/rule.rb', line 27 def matches(identifier) @pattern.captures(identifier) end |