Class: Nanoc::Core::ItemRepSelector
- Inherits:
-
Object
- Object
- Nanoc::Core::ItemRepSelector
- Defined in:
- lib/nanoc/core/item_rep_selector.rb
Overview
Yields item reps to compile.
Defined Under Namespace
Classes: ItemRepPriorityQueue
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(reps) ⇒ ItemRepSelector
constructor
A new instance of ItemRepSelector.
Constructor Details
#initialize(reps) ⇒ ItemRepSelector
Returns a new instance of ItemRepSelector.
7 8 9 |
# File 'lib/nanoc/core/item_rep_selector.rb', line 7 def initialize(reps) @reps = reps end |
Instance Method Details
#each ⇒ Object
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/nanoc/core/item_rep_selector.rb', line 104 def each pq = ItemRepPriorityQueue.new(@reps) loop do rep = pq.next break if rep.nil? begin yield(rep) pq.mark_ok rescue => e actual_error = e.is_a?(Nanoc::Core::Errors::CompilationError) ? e.unwrap : e if actual_error.is_a?(Nanoc::Core::Errors::UnmetDependency) pq.mark_failed(actual_error.rep) else raise(e) end end end end |