Class: Nanoc::Core::CompilationPhases::Resume
- Includes:
- Nanoc::Core::ContractsSupport
- Defined in:
- lib/nanoc/core/compilation_phases/resume.rb
Overview
Provides functionality for suspending and resuming item rep compilation (using fibers).
Constant Summary collapse
- DONE =
Object.new
Instance Method Summary collapse
Methods included from Nanoc::Core::ContractsSupport
enabled?, included, setup_once, warn_about_performance
Methods inherited from Abstract
#call, #initialize, #start, #stop
Constructor Details
This class inherits a constructor from Nanoc::Core::CompilationPhases::Abstract
Instance Method Details
#run(rep, is_outdated:, &block) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/nanoc/core/compilation_phases/resume.rb', line 13 def run(rep, is_outdated:, &block) fiber = fiber_for(rep, is_outdated:, &block) while fiber.alive? res = fiber.resume case res when Nanoc::Core::Errors::UnmetDependency Nanoc::Core::NotificationCenter.post(:compilation_suspended, rep, res.rep, res.snapshot_name) raise(res) when Proc fiber.resume(res.call) when DONE # ignore else raise Nanoc::Core::Errors::InternalInconsistency.new( "Fiber yielded object of unexpected type #{res.class}", ) end end end |