Class: Vedeu::Runtime::MainLoop
- Inherits:
-
Object
- Object
- Vedeu::Runtime::MainLoop
- Defined in:
- lib/vedeu/runtime/main_loop.rb
Overview
Provides the main loop for a Vedeu application.
Class Method Summary collapse
-
.safe_exit_point! ⇒ void
:nocov: Check the application has started and we wish to continue running.
-
.start! ⇒ void
:nocov: Start the main loop.
-
.stop! ⇒ void
Signal that we wish to terminate the running application.
Class Method Details
.safe_exit_point! ⇒ void
This method returns an undefined value.
:nocov: Check the application has started and we wish to continue running.
51 52 53 |
# File 'lib/vedeu/runtime/main_loop.rb', line 51 def safe_exit_point! fail Vedeu::Error::Interrupt if @started && !@loop end |
.start! ⇒ void
This method returns an undefined value.
:nocov: Start the main loop.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/vedeu/runtime/main_loop.rb', line 20 def start! @started = true @loop = true while @loop yield Vedeu::Terminal::Buffer.render safe_exit_point! end rescue Vedeu::Error::Interrupt Vedeu.log(type: :info, message: 'Vedeu execution interrupted, exiting.') end |
.stop! ⇒ void
This method returns an undefined value.
Signal that we wish to terminate the running application.
40 41 42 |
# File 'lib/vedeu/runtime/main_loop.rb', line 40 def stop! @loop = false end |