Class: Nanoc::Core::ItemRepBuilder Private
- Inherits:
-
Object
- Object
- Nanoc::Core::ItemRepBuilder
- Includes:
- ContractsSupport
- Defined in:
- lib/nanoc/core/item_rep_builder.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.
Instance Attribute Summary collapse
- #reps ⇒ Object readonly private
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(site, action_provider, reps) ⇒ ItemRepBuilder
constructor
private
A new instance of ItemRepBuilder.
- #run ⇒ Object private
Methods included from ContractsSupport
enabled?, included, setup_once, warn_about_performance
Constructor Details
#initialize(site, action_provider, reps) ⇒ ItemRepBuilder
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 ItemRepBuilder.
31 32 33 34 35 |
# File 'lib/nanoc/core/item_rep_builder.rb', line 31 def initialize(site, action_provider, reps) @site = site @action_provider = action_provider @reps = reps end |
Instance Attribute Details
#reps ⇒ Object (readonly)
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 |
# File 'lib/nanoc/core/item_rep_builder.rb', line 28 def reps @reps end |
Class Method Details
.snapshot_defs_for(action_sequence, rep) ⇒ 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.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/nanoc/core/item_rep_builder.rb', line 10 def self.snapshot_defs_for(action_sequence, rep) is_binary = rep.item.content.binary? snapshot_defs = [] action_sequence.each do |action| case action when Nanoc::Core::ProcessingActions::Snapshot action.snapshot_names.each do |snapshot_name| snapshot_defs << Nanoc::Core::SnapshotDef.new(snapshot_name, binary: is_binary) end when Nanoc::Core::ProcessingActions::Filter is_binary = Nanoc::Core::Filter.named!(action.filter_name).to_binary? end end snapshot_defs end |
Instance Method Details
#run ⇒ 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.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/nanoc/core/item_rep_builder.rb', line 37 def run @site.items.each do |item| @action_provider.rep_names_for(item).each do |rep_name| @reps << Nanoc::Core::ItemRep.new(item, rep_name) end end action_sequences = Nanoc::Core::ItemRepRouter.new(@reps, @action_provider, @site).run @reps.each do |rep| rep.snapshot_defs = self.class.snapshot_defs_for(action_sequences[rep], rep) end action_sequences end |