Sha256: d6e895403acaf3864da12da95e34e5dee27f7c317f0df06fdfb3bf245507f15a

Contents?: true

Size: 789 Bytes

Versions: 2

Compression:

Stored size: 789 Bytes

Contents

module Nanoc::Int::Compiler::Stages
  class StorePreCompilationState
    include Nanoc::Int::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::Int::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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nanoc-4.7.9 lib/nanoc/base/services/compiler/stages/store_pre_compilation_state.rb
nanoc-4.7.8 lib/nanoc/base/services/compiler/stages/store_pre_compilation_state.rb