Sha256: 87a755d61a0f86dca1e35d2a4b49c6e4fd5c09c448ecb87b671de4db6ac76ae5
Contents?: true
Size: 1.24 KB
Versions: 41
Compression:
Stored size: 1.24 KB
Contents
# frozen_string_literal: true module Nanoc::Int class ActionSequenceBuilder include Nanoc::Int::ContractsSupport def initialize(item_rep) @item_rep = item_rep @actions = [] end contract Symbol, Hash => self def add_filter(filter_name, params) @actions << Nanoc::Int::ProcessingActions::Filter.new(filter_name, params) self end contract String, C::Maybe[Hash] => self def add_layout(layout_identifier, params) @actions << Nanoc::Int::ProcessingActions::Layout.new(layout_identifier, params) self end contract Symbol, C::Maybe[String] => self def add_snapshot(snapshot_name, path) will_add_snapshot(snapshot_name) @actions << Nanoc::Int::ProcessingActions::Snapshot.new([snapshot_name], path ? [path] : []) self end contract C::None => Nanoc::Int::ActionSequence def action_sequence Nanoc::Int::ActionSequence.new(@item_rep, actions: @actions) end private def will_add_snapshot(name) @_snapshot_names ||= Set.new if @_snapshot_names.include?(name) raise Nanoc::Int::Errors::CannotCreateMultipleSnapshotsWithSameName.new(@item_rep, name) else @_snapshot_names << name end end end end
Version data entries
41 entries across 41 versions & 1 rubygems
Version | Path |
---|---|
nanoc-4.7.10 | lib/nanoc/base/services/action_sequence_builder.rb |