class CLI

Public Instance Methods

call() click to toggle source

Initiates the CLI and prompts user for initial exploration preferences

# File lib/Theatre_Explorer/cli.rb, line 3
def call
    system("clear")
    puts "
    =====================================
    ||   Welcome to Theatre Explore!   ||
    =====================================
    "
    initial_prompt
end
continue_prompt() click to toggle source

Sequence for repeated searches

# File lib/Theatre_Explorer/cli.rb, line 120
def continue_prompt
    puts "\nWould you like to explore more?"
    puts "Yes/No"
    input = gets.strip.downcase
    if input == "n" || input == "no" || input == "exit"
        goodbye
    else
        system("clear")
        initial_prompt
    end
end
goodbye() click to toggle source

Exit sequence

# File lib/Theatre_Explorer/cli.rb, line 143
def goodbye

    system("clear")
    puts "==========================="
    puts "|| Thanks for exploring! ||"
    puts "---------------------------"
    puts "||        Goodbye!       ||"
    puts "==========================="
    exit
end
initial_prompt() click to toggle source

Prompts user for initial exploration preferences

# File lib/Theatre_Explorer/cli.rb, line 14
def initial_prompt
    puts "How would you like to explore?"
    puts "---------------------------------"
    puts ""
    puts "1) Search by Year"
    puts "2) Search by production title"
    puts "\n\t ** or type Exit **"
    input = gets.strip.downcase
    case input
    when "exit"
        goodbye
    when "1"
        year_search
    when "2"
        production_search
    else 
        unclear
    end
end
unclear() click to toggle source

Sequence for invalid/unclear input

# File lib/Theatre_Explorer/cli.rb, line 133
def unclear
    system("clear")
    puts "I'm sorry. That seems to be invalid input.\n
    Please try again."
    sleep(1)
    system("clear")
    initial_prompt
end