Class: Nanoc::Core::ActionSequenceBuilder

Inherits:
Object
  • Object
show all
Includes:
ContractsSupport
Defined in:
lib/nanoc/core/action_sequence_builder.rb

Defined Under Namespace

Classes: CannotCreateMultipleSnapshotsWithSameNameError

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ContractsSupport

enabled?, included, setup_once, warn_about_performance

Constructor Details

#initializeActionSequenceBuilder

Returns a new instance of ActionSequenceBuilder.



24
25
26
# File 'lib/nanoc/core/action_sequence_builder.rb', line 24

def initialize
  @actions = []
end

Class Method Details

.build {|builder| ... } ⇒ Object

Yields:

  • (builder)


18
19
20
21
22
# File 'lib/nanoc/core/action_sequence_builder.rb', line 18

def self.build
  builder = new
  yield(builder)
  builder.action_sequence
end

Instance Method Details

#action_sequenceObject



47
48
49
# File 'lib/nanoc/core/action_sequence_builder.rb', line 47

def action_sequence
  Nanoc::Core::ActionSequence.new(actions: @actions)
end

#add_filter(filter_name, params) ⇒ Object



29
30
31
32
# File 'lib/nanoc/core/action_sequence_builder.rb', line 29

def add_filter(filter_name, params)
  @actions << Nanoc::Core::ProcessingActions::Filter.new(filter_name, params)
  self
end

#add_layout(layout_identifier, params) ⇒ Object



35
36
37
38
# File 'lib/nanoc/core/action_sequence_builder.rb', line 35

def add_layout(layout_identifier, params)
  @actions << Nanoc::Core::ProcessingActions::Layout.new(layout_identifier, params)
  self
end

#add_snapshot(snapshot_name, path, rep) ⇒ Object



40
41
42
43
44
# File 'lib/nanoc/core/action_sequence_builder.rb', line 40

def add_snapshot(snapshot_name, path, rep)
  will_add_snapshot(snapshot_name, rep)
  @actions << Nanoc::Core::ProcessingActions::Snapshot.new([snapshot_name], path ? [path] : [])
  self
end