Sha256: 5913059e21f5e064e8adca40f2fe9f69d708ff7de59d21e1cfea484e6f95221a
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nanoc-4.7.9 | lib/nanoc/base/services/action_sequence_builder.rb |
nanoc-4.7.8 | lib/nanoc/base/services/action_sequence_builder.rb |