Sha256: 5f773242846cb2d424eb5778f6269d734c00652ca9b3023921ed150b17b340c7
Contents?: true
Size: 1.56 KB
Versions: 2
Compression:
Stored size: 1.56 KB
Contents
# frozen_string_literal: true module Nanoc module Int # @api private class ItemRepBuilder include Nanoc::Core::ContractsSupport attr_reader :reps contract Nanoc::Core::Site, Nanoc::Core::ActionProvider, Nanoc::Core::ItemRepRepo => C::Any def initialize(site, action_provider, reps) @site = site @action_provider = action_provider @reps = reps end def run @site.items.each do |item| @action_provider.rep_names_for(item).each do |rep_name| @reps << Nanoc::Core::ItemRep.new(item, rep_name) end end action_sequences = Nanoc::Int::ItemRepRouter.new(@reps, @action_provider, @site).run @reps.each do |rep| rep.snapshot_defs = self.class.snapshot_defs_for(action_sequences[rep]) end action_sequences end contract Nanoc::Core::ActionSequence => C::ArrayOf[Nanoc::Core::SnapshotDef] def self.snapshot_defs_for(action_sequence) is_binary = action_sequence.item_rep.item.content.binary? snapshot_defs = [] action_sequence.each do |action| case action when Nanoc::Core::ProcessingActions::Snapshot action.snapshot_names.each do |snapshot_name| snapshot_defs << Nanoc::Core::SnapshotDef.new(snapshot_name, binary: is_binary) end when Nanoc::Core::ProcessingActions::Filter is_binary = Nanoc::Filter.named!(action.filter_name).to_binary? end end snapshot_defs end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nanoc-4.11.11 | lib/nanoc/base/services/item_rep_builder.rb |
nanoc-4.11.10 | lib/nanoc/base/services/item_rep_builder.rb |