class CLIInterface
Public Class Methods
detail_view(key)
click to toggle source
# File lib/cli_interface.rb, line 159 def self.detail_view(key) puts "\n\n Shortcut Key Sequence: #{key.key_seq}\n" puts " Shortcut Name: #{key.name.capitalize}\n" puts " Operating System: #{key.operating_system.name}\n" puts " Shortcut Description: #{key.description.capitalize}\n\n" end
error()
click to toggle source
# File lib/cli_interface.rb, line 166 def self.error puts "Your response was not understood.\n" puts "Please select a valid option.\n" end
not_found()
click to toggle source
# File lib/cli_interface.rb, line 171 def self.not_found puts "\nYour selection was not found or not understood.\n" puts "Please try a different search term or adjust your format.\n" end
Public Instance Methods
call()
click to toggle source
# File lib/cli_interface.rb, line 3 def call Scraper.new.scrape_atom welcome_greeting end
exit_method()
click to toggle source
# File lib/cli_interface.rb, line 153 def exit_method puts "\nThanks for using the Atom Shortcuts!" puts "See you again soon!\n\n\n" exit end
is_integer?(details_input)
click to toggle source
# File lib/cli_interface.rb, line 149 def is_integer?(details_input) details_input.to_i.to_s == details_input end
list_shortcuts()
click to toggle source
# File lib/cli_interface.rb, line 95 def list_shortcuts puts "\n*************************************" puts "\n ATOM SHORTCUTS FOR #{@os.name} OS" puts "\n*************************************\n\n" @os.sort_alphabetically @os.shortcuts.each_with_index do |shortcut, index| if (index)%10 == 0 && (index) != 0 puts "\n (Press Enter to Continue)\n\n" gets end puts " #{index + 1}. #{shortcut.name}: #{shortcut.key_seq} \n" end puts "\n\n" end
search_by_os_and_key()
click to toggle source
# File lib/cli_interface.rb, line 117 def search_by_os_and_key puts "Enter the key you would like to search for: \n" puts "(Use the format 'CTRL-K')\n" key_to_find = gets.strip.upcase @os.search_by_key(key_to_find) end
search_by_os_and_name()
click to toggle source
# File lib/cli_interface.rb, line 110 def search_by_os_and_name puts "Enter the shortcut name you would like to search for: \n" puts "(Use the format 'find in project')" name = gets.strip.downcase @os.search_by_name(name) end
set_os()
click to toggle source
# File lib/cli_interface.rb, line 84 def set_os if @user_os == "1" @os = OperatingSystem.find_by_name("Mac") elsif @user_os == "2" @os = OperatingSystem.find_by_name("Windows") else @os = OperatingSystem.find_by_name("Linux") end end
welcome_greeting()
click to toggle source
# File lib/cli_interface.rb, line 8 def welcome_greeting puts "\n\n\n****** Welcome To - Atom Shortcuts Quick Reference ******\n\n" puts " This is a cli utility gem designed as a quick reference\n" puts " to Atoms many shortcuts. With so many languages, commands,\n" puts " shortcuts and tools to memorize, you can now access a quick\n" puts " digital reference without having to interrupt your workflow.\n" puts " Being familiar with important shortcuts and commands speeds\n" puts " up your workflow and increases your productivity as a programmer.\n" puts "\n\nPress the ENTER key to continue....." any_key = gets if any_key.include?("\n") main_menu_display end end