class Nanoc::Core::ActionSequenceBuilder

Public Class Methods

build(rep) { |builder| ... } click to toggle source
# File lib/nanoc/core/action_sequence_builder.rb, line 18
def self.build(rep)
  builder = new(rep)
  yield(builder)
  builder.action_sequence
end
new(item_rep) click to toggle source
# File lib/nanoc/core/action_sequence_builder.rb, line 24
def initialize(item_rep)
  @item_rep = item_rep
  @actions = []
end

Public Instance Methods

action_sequence() click to toggle source
# File lib/nanoc/core/action_sequence_builder.rb, line 49
def action_sequence
  Nanoc::Core::ActionSequence.new(@item_rep, actions: @actions)
end
add_filter(filter_name, params) click to toggle source
# File lib/nanoc/core/action_sequence_builder.rb, line 30
def add_filter(filter_name, params)
  @actions << Nanoc::Core::ProcessingActions::Filter.new(filter_name, params)
  self
end
add_layout(layout_identifier, params) click to toggle source
# File lib/nanoc/core/action_sequence_builder.rb, line 36
def add_layout(layout_identifier, params)
  @actions << Nanoc::Core::ProcessingActions::Layout.new(layout_identifier, params)
  self
end
add_snapshot(snapshot_name, path) click to toggle source
# File lib/nanoc/core/action_sequence_builder.rb, line 42
def add_snapshot(snapshot_name, path)
  will_add_snapshot(snapshot_name)
  @actions << Nanoc::Core::ProcessingActions::Snapshot.new([snapshot_name], path ? [path] : [])
  self
end

Private Instance Methods

will_add_snapshot(name) click to toggle source
# File lib/nanoc/core/action_sequence_builder.rb, line 55
def will_add_snapshot(name)
  @_snapshot_names ||= Set.new
  if @_snapshot_names.include?(name)
    raise CannotCreateMultipleSnapshotsWithSameNameError.new(@item_rep, name)
  else
    @_snapshot_names << name
  end
end