Class: Vedeu::Runtime::MainLoop Private
- Inherits:
-
Object
- Object
- Vedeu::Runtime::MainLoop
- Defined in:
- lib/vedeu/runtime/main_loop.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Provides the main loop for a Vedeu application.
Class Method Summary collapse
- .mode_switch!(mode = nil) ⇒ Object private
-
.safe_exit_point! ⇒ void
private
Check the application has started and we wish to continue running.
-
.start! ⇒ void
private
Start the main loop.
-
.stop! ⇒ void
private
Signal that we wish to terminate the running application.
Class Method Details
.mode_switch!(mode = nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/vedeu/runtime/main_loop.rb', line 22 def mode_switch!(mode = nil) @loop = false @mode_switch = true Vedeu::Terminal::Mode.switch_mode!(mode) Vedeu.trigger(:_drb_restart_) raise Vedeu::Error::ModeSwitch end |
.safe_exit_point! ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Check the application has started and we wish to continue running.
68 69 70 |
# File 'lib/vedeu/runtime/main_loop.rb', line 68 def safe_exit_point! raise Vedeu::Error::Interrupt if @started && !@loop end |
.start! ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Start the main loop.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/vedeu/runtime/main_loop.rb', line 37 def start! @started = true @loop = true @mode_switch = false Vedeu.trigger(:_refresh_cursor_, Vedeu.focus) Vedeu.trigger(:_refresh_) while @loop yield safe_exit_point! end rescue Vedeu::Error::Interrupt Vedeu.log(message: 'Vedeu execution interrupted, exiting.') end |
.stop! ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Signal that we wish to terminate the running application.
58 59 60 |
# File 'lib/vedeu/runtime/main_loop.rb', line 58 def stop! @loop = false end |