Class: Nanoc::RuleDSL::ActionRecorder Private
- Inherits:
-
Object
- Object
- Nanoc::RuleDSL::ActionRecorder
- Includes:
- Core::ContractsSupport
- Defined in:
- lib/nanoc/rule_dsl/action_recorder.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- MaybePathlike =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
C::Or[nil, Nanoc::Core::UNDEFINED, String, Nanoc::Core::Identifier]
Instance Method Summary collapse
- #action_sequence ⇒ Object private
- #any_layouts? ⇒ Boolean private
- #filter(filter_name, filter_args = {}) ⇒ Object private
-
#initialize(item_rep) ⇒ ActionRecorder
constructor
private
A new instance of ActionRecorder.
- #inspect ⇒ Object private
- #last_snapshot? ⇒ Boolean private
- #layout(layout_identifier, extra_filter_args = {}) ⇒ Object private
- #pre_snapshot? ⇒ Boolean private
- #snapshot(snapshot_name, path: Nanoc::Core::UNDEFINED) ⇒ Object private
- #snapshots_for_which_to_skip_routing_rule ⇒ Object private
Constructor Details
#initialize(item_rep) ⇒ ActionRecorder
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ActionRecorder.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/nanoc/rule_dsl/action_recorder.rb', line 9 def initialize(item_rep) @item_rep = item_rep @action_sequence_builder = Nanoc::Core::ActionSequenceBuilder.new @any_layouts = false @last_snapshot = false @pre_snapshot = false @snapshots_for_which_to_skip_routing_rule = Set.new end |
Instance Method Details
#action_sequence ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
67 68 69 |
# File 'lib/nanoc/rule_dsl/action_recorder.rb', line 67 def action_sequence @action_sequence_builder.action_sequence end |
#any_layouts? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
72 73 74 |
# File 'lib/nanoc/rule_dsl/action_recorder.rb', line 72 def any_layouts? @any_layouts end |
#filter(filter_name, filter_args = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 |
# File 'lib/nanoc/rule_dsl/action_recorder.rb', line 24 def filter(filter_name, filter_args = {}) @action_sequence_builder.add_filter(filter_name, filter_args) end |
#inspect ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 |
# File 'lib/nanoc/rule_dsl/action_recorder.rb', line 20 def inspect "<#{self.class}>" end |
#last_snapshot? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
82 83 84 |
# File 'lib/nanoc/rule_dsl/action_recorder.rb', line 82 def last_snapshot? @last_snapshot end |
#layout(layout_identifier, extra_filter_args = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/nanoc/rule_dsl/action_recorder.rb', line 28 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, @item_rep) end @action_sequence_builder.add_layout(layout_identifier, extra_filter_args) @any_layouts = true end |
#pre_snapshot? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
87 88 89 |
# File 'lib/nanoc/rule_dsl/action_recorder.rb', line 87 def pre_snapshot? @pre_snapshot end |
#snapshot(snapshot_name, path: Nanoc::Core::UNDEFINED) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/nanoc/rule_dsl/action_recorder.rb', line 44 def snapshot(snapshot_name, path: Nanoc::Core::UNDEFINED) unless Nanoc::Core::UNDEFINED.equal?(path) @snapshots_for_which_to_skip_routing_rule << snapshot_name end path = if Nanoc::Core::UNDEFINED.equal?(path) || path.nil? nil else path.to_s end @action_sequence_builder.add_snapshot(snapshot_name, path, @item_rep) case snapshot_name when :last @last_snapshot = true when :pre @pre_snapshot = true end nil end |
#snapshots_for_which_to_skip_routing_rule ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
77 78 79 |
# File 'lib/nanoc/rule_dsl/action_recorder.rb', line 77 def snapshots_for_which_to_skip_routing_rule @snapshots_for_which_to_skip_routing_rule end |