Sha256: bfee0715888815417655c66038874471c25d30c3a1f5f252351822ddc3780889

Contents?: true

Size: 635 Bytes

Versions: 2

Compression:

Stored size: 635 Bytes

Contents

# frozen_string_literal: true
require 'singleton'

module Junction
  class ScreenManager
    include Singleton

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

    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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
junction-0.1.10 lib/junction/screen_manager.rb
junction-0.1.9 lib/junction/screen_manager.rb