Class: Vedeu::Application
- Inherits:
-
Object
- Object
- Vedeu::Application
- Defined in:
- lib/vedeu/application.rb
Class Method Summary collapse
-
.restart ⇒ Object
[].
-
.start ⇒ Object
[].
Instance Method Summary collapse
- #initialize ⇒ Application constructor
-
#main_sequence ⇒ Object
private
private
[].
-
#run_many ⇒ Object
private
private
[].
-
#runner ⇒ Object
private
private
[].
-
#start ⇒ Object
Starts the application! - A new terminal screen is opened (or rather the current terminal is requested into either :raw or :cooked mode).
Constructor Details
Class Method Details
.restart ⇒ Object
Returns [].
9 10 11 |
# File 'lib/vedeu/application.rb', line 9 def start new.start end |
.start ⇒ Object
Returns [].
6 7 8 |
# File 'lib/vedeu/application.rb', line 6 def start new.start end |
Instance Method Details
#main_sequence ⇒ Object (private)
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.
Returns [].
54 55 56 57 58 59 60 61 62 |
# File 'lib/vedeu/application.rb', line 54 def main_sequence if Configuration.interactive? Input.capture else # TODO: What should happen here? end end |
#run_many ⇒ Object (private)
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.
Returns [].
66 67 68 69 70 71 72 73 74 |
# File 'lib/vedeu/application.rb', line 66 def run_many loop { yield } rescue ModeSwitch Terminal.switch_mode! Application.restart end |
#runner ⇒ Object (private)
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.
Returns [].
42 43 44 45 46 47 48 49 50 |
# File 'lib/vedeu/application.rb', line 42 def runner if Configuration.once? yield else run_many { yield } end end |
#start ⇒ Object
Starts the application!
-
A new terminal screen is opened (or rather the current terminal is requested into either :raw or :cooked mode).
-
The cursor visibility is then set dependent on this mode. In :raw mode, the cursor is hidden.
-
The ‘:initialize` event is triggered. Vedeu does not handle this event; the client application may treat this event as Vedeu signalling that it is now ready.
-
We enter into the main sequence where the application will either run once or continuous, interactively or standalone.
28 29 30 31 32 33 34 35 36 |
# File 'lib/vedeu/application.rb', line 28 def start Terminal.open do Terminal.set_cursor_mode Vedeu.events.trigger(:_initialize_) runner { main_sequence } end end |