Class: Nanoc::Core::CompilationPhases::Recalculate
- Includes:
- Nanoc::Core::ContractsSupport
- Defined in:
- lib/nanoc/core/compilation_phases/recalculate.rb
Overview
Provides functionality for (re)calculating the content of an item rep, without caching or outdatedness checking.
Instance Method Summary collapse
-
#initialize(action_sequences:, dependency_store:, compilation_context:) ⇒ Recalculate
constructor
A new instance of Recalculate.
-
#run(rep, is_outdated:) ⇒ Object
rubocop:disable Lint/UnusedMethodArgument.
Methods included from Nanoc::Core::ContractsSupport
enabled?, included, setup_once, warn_about_performance
Methods inherited from Abstract
Constructor Details
#initialize(action_sequences:, dependency_store:, compilation_context:) ⇒ Recalculate
Returns a new instance of Recalculate.
11 12 13 14 15 16 17 |
# File 'lib/nanoc/core/compilation_phases/recalculate.rb', line 11 def initialize(action_sequences:, dependency_store:, compilation_context:) super(wrapped: nil) @action_sequences = action_sequences @dependency_store = dependency_store @compilation_context = compilation_context end |
Instance Method Details
#run(rep, is_outdated:) ⇒ Object
rubocop:disable Lint/UnusedMethodArgument
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/nanoc/core/compilation_phases/recalculate.rb', line 20 def run(rep, is_outdated:) # rubocop:disable Lint/UnusedMethodArgument dependency_tracker = Nanoc::Core::DependencyTracker.new(@dependency_store) dependency_tracker.enter(rep.item) executor = Nanoc::Core::Executor.new(rep, @compilation_context, dependency_tracker) @compilation_context.compiled_content_store.set_current(rep, rep.item.content) actions = @action_sequences[rep] actions.each do |action| case action when Nanoc::Core::ProcessingActions::Filter executor.filter(action.filter_name, action.params) when Nanoc::Core::ProcessingActions::Layout executor.layout(action.layout_identifier, action.params) when Nanoc::Core::ProcessingActions::Snapshot action.snapshot_names.each do |snapshot_name| executor.snapshot(snapshot_name) end else raise Nanoc::Core::Errors::InternalInconsistency, "unknown action #{action.inspect}" end end ensure dependency_tracker.exit end |