class Nanoc::RuleDSL::RecordingExecutor
Attributes
rule_memory[R]
Public Class Methods
new(item_rep, rules_collection, site)
click to toggle source
# File lib/nanoc/rule_dsl/recording_executor.rb, line 12 def initialize(item_rep, rules_collection, site) @item_rep = item_rep @rules_collection = rules_collection @site = site @rule_memory = Nanoc::Int::RuleMemory.new(item_rep) end
Public Instance Methods
basic_path_from_rules_for(rep, snapshot_name)
click to toggle source
# File lib/nanoc/rule_dsl/recording_executor.rb, line 37 def basic_path_from_rules_for(rep, snapshot_name) routing_rules = @rules_collection.routing_rules_for(rep) routing_rule = routing_rules[snapshot_name] return nil if routing_rule.nil? basic_path = routing_rule.apply_to(rep, executor: nil, site: @site, view_context: nil) if basic_path && !basic_path.start_with?('/') raise PathWithoutInitialSlashError.new(rep, basic_path) end basic_path end
filter(_rep, filter_name, filter_args = {})
click to toggle source
# File lib/nanoc/rule_dsl/recording_executor.rb, line 20 def filter(_rep, filter_name, filter_args = {}) @rule_memory.add_filter(filter_name, filter_args) end
layout(_rep, layout_identifier, extra_filter_args = {})
click to toggle source
# File lib/nanoc/rule_dsl/recording_executor.rb, line 24 def layout(_rep, layout_identifier, extra_filter_args = {}) unless @rule_memory.any_layouts? @rule_memory.add_snapshot(:pre, true, nil) end @rule_memory.add_layout(layout_identifier, extra_filter_args) end
snapshot(rep, snapshot_name, final: true, path: nil)
click to toggle source
# File lib/nanoc/rule_dsl/recording_executor.rb, line 32 def snapshot(rep, snapshot_name, final: true, path: nil) actual_path = final ? (path || basic_path_from_rules_for(rep, snapshot_name)) : nil @rule_memory.add_snapshot(snapshot_name, final, actual_path) end