Class: Nanoc::Int::Compiler::Phases::Recalculate
- Defined in:
- lib/nanoc/base/services/compiler/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 inherited from Abstract
Constructor Details
#initialize(action_sequences:, dependency_store:, compilation_context:) ⇒ Recalculate
Returns a new instance of Recalculate
9 10 11 12 13 14 15 |
# File 'lib/nanoc/base/services/compiler/phases/recalculate.rb', line 9 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
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/nanoc/base/services/compiler/phases/recalculate.rb', line 18 def run(rep, is_outdated:) # rubocop:disable Lint/UnusedMethodArgument dependency_tracker = Nanoc::Int::DependencyTracker.new(@dependency_store) dependency_tracker.enter(rep.item) executor = Nanoc::Int::Executor.new(rep, @compilation_context, dependency_tracker) @compilation_context.snapshot_repo.set(rep, :last, rep.item.content) actions = @action_sequences[rep] actions.each do |action| case action when Nanoc::Int::ProcessingActions::Filter executor.filter(action.filter_name, action.params) when Nanoc::Int::ProcessingActions::Layout executor.layout(action.layout_identifier, action.params) when Nanoc::Int::ProcessingActions::Snapshot action.snapshot_names.each do |snapshot_name| executor.snapshot(snapshot_name) end else raise Nanoc::Int::Errors::InternalInconsistency, "unknown action #{action.inspect}" end end ensure dependency_tracker.exit end |