Sha256: 592fae9ece9ef46e706c73e36411163be1257631e2b28b4952332b35a518c2b8

Contents?: true

Size: 671 Bytes

Versions: 1

Compression:

Stored size: 671 Bytes

Contents

module Nanoc::Int
  # @api private
  class Preprocessor
    def initialize(site:, rules_collection:)
      @site = site
      @rules_collection = rules_collection
    end

    def run
      ctx = new_preprocessor_context

      @rules_collection.preprocessors.each_value do |preprocessor|
        ctx.instance_eval(&preprocessor)
      end
    end

    # @api private
    def new_preprocessor_context
      Nanoc::Int::Context.new(
        config: Nanoc::MutableConfigView.new(@site.config, nil),
        items: Nanoc::MutableItemCollectionView.new(@site.items, nil),
        layouts: Nanoc::MutableLayoutCollectionView.new(@site.layouts, nil),
      )
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nanoc-4.1.0a1 lib/nanoc/base/services/preprocessor.rb