Class: Muby::Application
- Inherits:
-
Object
- Object
- Muby::Application
- Includes:
- Configurable, Displayer
- Defined in:
- lib/muby/application.rb
Instance Method Summary collapse
-
#initialize ⇒ Application
constructor
A new instance of Application.
Methods included from Displayer
debug, error, exception, info, trace, warn
Methods included from Configurable
Constructor Details
#initialize ⇒ Application
Returns a new instance of Application.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/muby/application.rb', line 9 def initialize # # Load all user files # conf.load_user_files! # Init all the ncurses magic. Ncurses.initscr Ncurses.raw Ncurses.keypad(Ncurses.stdscr, true) Ncurses.noecho Ncurses.refresh if Ncurses.has_colors? Ncurses.start_color end # initialize late (to enable changes from $RC_FILE) Muby::OutputWindow.get_instance.go Muby::InputWindow.get_instance.go # # Exit commands # If we die by normal death (control-C for example): # at_exit do begin conf.shutdown_triggers.each do |proc| Muby::InputWindow.get_instance.execute(proc) end Muby::InputWindow.get_instance.saveHistory rescue Exception => e exception(e) error("Sleeping 10 seconds before closing") sleep(10) ensure Ncurses.endwin puts "Exiting muby..." end end # # The main loop # begin Muby::InputWindow.get_instance.process rescue SystemExit => ex violentDeath = false raise ex rescue Exception => error exception(error) error("Sleeping 10 seconds before closing") sleep(10) end end |