class Fourteeninch::Core

Public Class Methods

clear() click to toggle source
# File lib/fourteeninch/core.rb, line 14
def self.clear
  system("clear") || system("cls")
end
core() click to toggle source
# File lib/fourteeninch/core.rb, line 18
def self.core
  Fourteeninch.load_settings
  if Fourteeninch::Auth.auth != false
  menu = Fourteeninch::Core.do_core(0)
  while menu != -1
    menu = Fourteeninch::Core.do_core(menu)
  end
  else
    puts "You are not logged in. Run `fourteeninch login` now to access fourteeninch core."
  end
end
do_core(menu = 0) click to toggle source
# File lib/fourteeninch/core.rb, line 32
def self.do_core(menu = 0)
  clear
  case menu
  when 0
    return Fourteeninch::MainMenu.intro
  when 1
    return Fourteeninch::Customers.customers_menu
  when 11
    return Fourteeninch::Customers.list_customers
  when 12
    return Fourteeninch::Customers.new_customer
  when 2
    # Show invoices menu
  when 3
    #show Admin Users Menu
  when 9
    Fourteeninch::Auth.logout
    puts "Good bye..."
    return -1
  when 0
    puts "Good bye..."
    return -1
  else
    return 0
  end
end
press_a_key() click to toggle source
# File lib/fourteeninch/core.rb, line 4
def self.press_a_key
  print "Please press any key to continue..."
  begin
    system("stty raw -echo")
    STDIN.getc
  ensure
    system("stty -raw echo")
  end
end