Sha256: 90e921f1caf0b3260fb0bf6b9c37c02058561f499d2d21cc8537aa639269a39c

Contents?: true

Size: 747 Bytes

Versions: 1

Compression:

Stored size: 747 Bytes

Contents

# frozen_string_literal: true

module Cryptum
  module UI
    # This Class is Used to Detect Key Press Events
    module Exit
      public_class_method def self.gracefully(opts = {})
        event_history = opts[:event_history]

        Curses.close_screen

        exit 0
      rescue StandardError => e
        # Produce a Stacktrace for anything else
        raise e
      ensure
        if event_history
          order_book_file = event_history.order_book[:path]
          File.write(
            order_book_file,
            JSON.pretty_generate(event_history.order_book)
          )
        end
      end

      # Display a List of Every UI Module

      public_class_method def self.help
        constants.sort
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cryptum-0.0.386 lib/cryptum/ui/exit.rb