Class: Nanoc::RuleDSL::RoutingRule Private
- Includes:
- Core::ContractsSupport
- Defined in:
- lib/nanoc/rule_dsl/routing_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.
Instance Attribute Summary collapse
- #snapshot_name ⇒ Object readonly private
Attributes inherited from Rule
Instance Method Summary collapse
- #apply_to(rep, site:, view_context:) ⇒ Object private
-
#initialize(pattern, rep_name, block, snapshot_name: nil) ⇒ RoutingRule
constructor
private
A new instance of RoutingRule.
Methods inherited from Rule
Constructor Details
#initialize(pattern, rep_name, block, snapshot_name: nil) ⇒ RoutingRule
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 RoutingRule.
11 12 13 14 15 |
# File 'lib/nanoc/rule_dsl/routing_rule.rb', line 11 def initialize(pattern, rep_name, block, snapshot_name: nil) super(pattern, rep_name, block) @snapshot_name = snapshot_name end |
Instance Attribute Details
#snapshot_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/routing_rule.rb', line 8 def snapshot_name @snapshot_name end |
Instance Method Details
#apply_to(rep, site:, view_context:) ⇒ 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.
21 22 23 24 25 26 27 |
# File 'lib/nanoc/rule_dsl/routing_rule.rb', line 21 def apply_to(rep, site:, view_context:) context = Nanoc::RuleDSL::RoutingRuleContext.new( rep:, site:, view_context:, ) context.instance_exec(matches(rep.item.identifier), &@block) end |