Class: Menu::Main
Overview
MenuMain handlers
Instance Method Summary collapse
- #create_input_map ⇒ Object
- #create_procs_map ⇒ Object
-
#run_login ⇒ Object
Login user.
-
#run_logout ⇒ Object
Logout user.
-
#run_setup ⇒ Object
Run setup wizard.
Methods inherited from Base
#initialize, #run_default, #run_selected_command
Constructor Details
This class inherits a constructor from Menu::Base
Instance Method Details
#create_input_map ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/menu/main.rb', line 24 def create_input_map { setup: [:setup], login: [:login], logout: [:logout] } end |
#create_procs_map ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/menu/main.rb', line 32 def create_procs_map { setup: proc { run_setup }, login: proc { run_login }, logout: proc { run_logout } } end |
#run_login ⇒ Object
Login user
41 42 43 44 45 46 47 48 |
# File 'lib/menu/main.rb', line 41 def run_login if Communication::SessionManager.logged_in? Utilities.log("You are already logged in.", { type: :info }) else Utilities.log("Please enter your login credentials.") SetupWizard.new.configure_login_credentials end end |
#run_logout ⇒ Object
Logout user
51 52 53 54 55 56 |
# File 'lib/menu/main.rb', line 51 def run_logout Communication::SessionManager.logout Utilities.log("Logout success.", { type: :success }) rescue LogworkException::UserNotLoggedIn => e Utilities.log(e, { type: :error }) end |
#run_setup ⇒ Object
Run setup wizard
59 60 61 |
# File 'lib/menu/main.rb', line 59 def run_setup SetupWizard.new.run end |