Class: Nanoc::RuleDSL::RecordingExecutor
- Inherits:
-
Object
- Object
- Nanoc::RuleDSL::RecordingExecutor
- Defined in:
- lib/nanoc/rule_dsl/recording_executor.rb
Constant Summary
- Pathlike =
C::Maybe[C::Or[String, Nanoc::Identifier]
Instance Method Summary collapse
-
#action_sequence ⇒ Object
-
#any_layouts? ⇒ Boolean
-
#filter(filter_name, filter_args = {}) ⇒ Object
-
#initialize(rep) ⇒ RecordingExecutor
constructor
A new instance of RecordingExecutor.
-
#last_snapshot? ⇒ Boolean
-
#layout(layout_identifier, extra_filter_args = {}) ⇒ Object
-
#pre_snapshot? ⇒ Boolean
-
#snapshot(snapshot_name, path: nil) ⇒ Object
Constructor Details
#initialize(rep) ⇒ RecordingExecutor
Returns a new instance of RecordingExecutor
9 10 11 12 13 14 15 |
# File 'lib/nanoc/rule_dsl/recording_executor.rb', line 9 def initialize(rep) @action_sequence_builder = Nanoc::Int::ActionSequenceBuilder.new(rep) @any_layouts = false @last_snapshot = false @pre_snapshot = false end |
Instance Method Details
#action_sequence ⇒ Object
49 50 51 |
# File 'lib/nanoc/rule_dsl/recording_executor.rb', line 49 def action_sequence @action_sequence_builder.action_sequence end |
#any_layouts? ⇒ Boolean
54 55 56 |
# File 'lib/nanoc/rule_dsl/recording_executor.rb', line 54 def any_layouts? @any_layouts end |
#filter(filter_name, filter_args = {}) ⇒ Object
17 18 19 |
# File 'lib/nanoc/rule_dsl/recording_executor.rb', line 17 def filter(filter_name, filter_args = {}) @action_sequence_builder.add_filter(filter_name, filter_args) end |
#last_snapshot? ⇒ Boolean
59 60 61 |
# File 'lib/nanoc/rule_dsl/recording_executor.rb', line 59 def last_snapshot? @last_snapshot end |
#layout(layout_identifier, extra_filter_args = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/nanoc/rule_dsl/recording_executor.rb', line 21 def layout(layout_identifier, extra_filter_args = {}) unless layout_identifier.is_a?(String) raise ArgumentError.new('The layout passed to #layout must be a string') end unless any_layouts? @pre_snapshot = true @action_sequence_builder.add_snapshot(:pre, nil) end @action_sequence_builder.add_layout(layout_identifier, extra_filter_args) @any_layouts = true end |
#pre_snapshot? ⇒ Boolean
64 65 66 |
# File 'lib/nanoc/rule_dsl/recording_executor.rb', line 64 def pre_snapshot? @pre_snapshot end |
#snapshot(snapshot_name, path: nil) ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/nanoc/rule_dsl/recording_executor.rb', line 37 def snapshot(snapshot_name, path: nil) @action_sequence_builder.add_snapshot(snapshot_name, path && path.to_s) case snapshot_name when :last @last_snapshot = true when :pre @pre_snapshot = true end nil end |