class Cli

Public Instance Methods

get_input() click to toggle source
# File lib/services/cli.rb, line 68
def get_input
    gets.chomp
end
main_menu() click to toggle source
main_menu_options() click to toggle source
standardize_crypto_name_length() click to toggle source
if exit_option == "Y"
    puts ""
    puts "Closing program..."
    puts ""
elsif exit_option == "N"
    main_menu
else
    puts "Invalid entry! Please try again..".red
    puts ""
    exit?
end

end

# File lib/services/cli.rb, line 89
def standardize_crypto_name_length
    max_length = 25

    CryptoStats.all.each do |crypto|
        while crypto.name.length < max_length
            crypto.name += " "
        end
    end
end
start() click to toggle source
# File lib/services/cli.rb, line 3
def start
    puts ""
    puts "---------------------------------------------".yellow
    puts "---------- Welcome to CryptoStats! ----------".yellow
    puts "---------------------------------------------".yellow
    puts ""
    puts " ~~> fetching data from CoinGecko...".blue
    sleep(1)
    puts " ~~> loading the top 100 cryptocurrencies...".blue
    sleep(1)
    Api.load_data
    main_menu
end