Sha256: df04916ef8a8143f7b33822c0d34997f31e5a6fbdc4adbad827a9cc0e7dac1ee

Contents?: true

Size: 833 Bytes

Versions: 3

Compression:

Stored size: 833 Bytes

Contents

# frozen_string_literal: true

module Nanoc
  module Int
    class AggregateDataSource < Nanoc::DataSource
      def initialize(data_sources, config)
        super({}, '/', '/', {})

        @data_sources = data_sources
        @config = config
      end

      def items
        @_items ||= begin
          objs = @data_sources.flat_map(&:items)
          Nanoc::Core::ItemCollection.new(@config, objs)
        end
      end

      def layouts
        @_layouts ||= begin
          objs = @data_sources.flat_map(&:layouts)
          Nanoc::Core::LayoutCollection.new(@config, objs)
        end
      end

      def item_changes
        SlowEnumeratorTools.merge(@data_sources.map(&:item_changes))
      end

      def layout_changes
        SlowEnumeratorTools.merge(@data_sources.map(&:layout_changes))
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nanoc-4.11.3 lib/nanoc/base/repos/aggregate_data_source.rb
nanoc-4.11.2 lib/nanoc/base/repos/aggregate_data_source.rb
nanoc-4.11.1 lib/nanoc/base/repos/aggregate_data_source.rb