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: MicroGraph
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
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/nanoc/core/item_rep_selector.rb', line 44 def each mg = MicroGraph.new(@reps) loop do rep = mg.next break if rep.nil? begin yield(rep) mg.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) mg.mark_failed(actual_error.rep) else raise(e) end end end end |