Sha256: 8ce4ed4c0bcae2363e6c07f5dbc56ade8d60223eae2dbfbe996add15d3ee9a1d

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

module Nanoc
  module Int
    class Compiler
      module Stages
        class StorePreCompilationState < Nanoc::Core::CompilationStage
          include Nanoc::Core::ContractsSupport

          def initialize(reps:, layouts:, checksum_store:, action_sequence_store:, action_sequences:)
            @reps = reps
            @layouts = layouts
            @checksum_store = checksum_store
            @action_sequence_store = action_sequence_store
            @action_sequences = action_sequences
          end

          contract Nanoc::Core::ChecksumCollection => C::Any
          def run(checksums)
            # Calculate action sequence
            (@reps.to_a + @layouts.to_a).each do |obj|
              @action_sequence_store[obj] = @action_sequences[obj].serialize
            end
            @action_sequence_store.store

            # Set checksums
            @checksum_store.checksums = checksums.to_h
            @checksum_store.store
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nanoc-4.11.12 lib/nanoc/base/services/compiler/stages/store_pre_compilation_state.rb
nanoc-4.11.11 lib/nanoc/base/services/compiler/stages/store_pre_compilation_state.rb
nanoc-4.11.10 lib/nanoc/base/services/compiler/stages/store_pre_compilation_state.rb