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
Check the application has started and we wish to continue running.
-
.start! ⇒ void
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.
Check the application has started and we wish to continue running.
55 56 57 |
# File 'lib/vedeu/runtime/main_loop.rb', line 55 def safe_exit_point! fail Vedeu::Error::Interrupt if @started && !@loop end |
.start! ⇒ void
This method returns an undefined value.
Start the main loop.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/vedeu/runtime/main_loop.rb', line 21 def start! @started = true @loop = true Vedeu.trigger(:_refresh_cursor_, Vedeu.focus) while @loop Vedeu.refresh yield safe_exit_point! end rescue Vedeu::Error::Interrupt Vedeu.log(message: 'Vedeu execution interrupted, exiting.'.freeze) end |
.stop! ⇒ void
This method returns an undefined value.
Signal that we wish to terminate the running application.
43 44 45 |
# File 'lib/vedeu/runtime/main_loop.rb', line 43 def stop! @loop = false end |