Class: Junction::ScreenManager

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/junction/screen_manager.rb

Instance Method Summary collapse

Constructor Details

#initializeScreenManager

Returns a new instance of ScreenManager.



8
9
10
11
# File 'lib/junction/screen_manager.rb', line 8

def initialize
  @menu_screen = Junction::Screens::MenuScreen.new
  @running = true
end

Instance Method Details

#startObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/junction/screen_manager.rb', line 13

def start
  # Trap Ctrl+C (SIGINT) to exit gracefully
  trap("SIGINT") do
    puts "\nExiting gracefully... Goodbye!"
    @running = false
  end

  while @running
    begin
      @menu_screen.render
    rescue Interrupt
      # Handle any mid-operation interruption if necessary
      puts "\nInterrupted! Returning to the menu."
    end
  end
end