module MenuHelpers

Public Class Methods

clear() click to toggle source
# File lib/helpers/menus/menu_helpers.rb, line 12
def self.clear
  system('clear')
end
request_input_continue_for_menu(menu_kind) click to toggle source
# File lib/helpers/menus/menu_helpers.rb, line 41
def self.request_input_continue_for_menu(menu_kind)
  puts "\nPress any key to continue..."
  gets.chomp
  MenuHelpers.show_menu_for_menu_kind(menu_kind)
end
show_menu_for_menu_kind(menu_kind) click to toggle source
# File lib/helpers/menus/menu_helpers.rb, line 30
def self.show_menu_for_menu_kind(menu_kind)
  case menu_kind
    when "main"
      Menu.show_main_menu
    when "sub_help"
      SubmenuHelp.show_sub_menu
    when "sub_demo"
      SubmenuDemo.show_sub_menu
  end
end
terminal_table(headings = [], *rows, &block) click to toggle source

Reference: github.com/scarsam/crypto_market/blob/master/lib/crypto_market.rb

# File lib/helpers/menus/menu_helpers.rb, line 8
def self.terminal_table(headings = [], *rows, &block)
  Terminal::Table.new :headings => headings.to_a, :rows => rows, &block
end
validate_input_for_menu_kind(menu_kind) click to toggle source
# File lib/helpers/menus/menu_helpers.rb, line 16
def self.validate_input_for_menu_kind(menu_kind)
  MenuHelpers.clear
  puts "== Invalid option chosen. Try again ==\n"
  Menu.show_main_menu
  case menu_kind
    when "main"
      Menu.show_main_menu
    when "sub_help"
      SubmenuHelp.show_sub_menu
    when "sub_demo"
      SubmenuDemo.show_sub_menu
  end
end