lib/crypto_price/cli.rb in crypto_price-0.1.4 vs lib/crypto_price/cli.rb in crypto_price-0.1.5
- old
+ new
@@ -5,60 +5,71 @@
menu
end
def menu
- puts "| ================================ |"
- puts "| Current Crypto-Currencies Prices |"
- puts "| ================================ |"
- puts "| |"
+ 5.times do
+ puts " "
+ end
+ puts " ================================ "
+ puts " Current Crypto-Currencies Prices "
+ puts " ================================ "
+ puts " "
puts "|========================================================================|"
puts "| Today's top Crypto! |"
input = nil
- while input != "exit"
+ while input != "x"
puts "|========================================================================|"
puts "| |"
puts "| |"
puts "| Choose an option Number: |"
+ puts "| |"
+ puts "| when done type 'x' |"
puts "| ___________________ |"
puts "| |"
puts "| |"
puts "| |"
puts "| - 1. Top 10 coins - 2. Top 50 Coins | "
puts "| |"
- puts "| - 3. exit |"
puts "| |"
+ puts "| |"
puts "|________________________________________________________________________|"
+ 3.times do
+ puts " "
+ end
input = gets.strip
- CryptoPrice::Scraper.scrape_coinlib
+ CryptoPrice::Scraper.scrape_coins
case input
- when "1"
- top_ten(CryptoPrice::Coin.all)
- input = gets.strip
- c = CryptoPrice::Coin.all[input.to_i]
- show_info(input, c)
- when "2"
- top_fifty(CryptoPrice::Coin.all)
- input = gets.strip
- d = CryptoPrice::Coin.all[input.to_i]
- show_info(input, d)
- when "exit"
- 5.times do
- puts " "
- end
- puts "Have a good day!"
- 5.times do
- puts " "
- end
- else
- 5.times do
- puts " "
+ when "1"
+ top_ten(CryptoPrice::Coin.all)
+ input = gets.strip
+ c = CryptoPrice::Coin.all[input.to_i]
+ show_info(input, c)
+ when "2"
+ top_fifty(CryptoPrice::Coin.all)
+ input = gets.strip
+ d = CryptoPrice::Coin.all[input.to_i]
+ show_info(input, d)
+ when "x"
+ 5.times do
+ puts " "
end
- puts "Type 'Exit' when you are done!"
- end
+ puts "Have a good day!"
+ 5.times do
+ puts " "
+ end
+ else
+ 5.times do
+ puts " "
+ end
+ puts "Type 'x' when you are done!"
+ 5.times do
+ puts " "
+ end
+ end
end
end
def individual(index, coin)
2.times do
@@ -75,18 +86,20 @@
def show_info(index, coin)
2.times do
puts " "
end
- puts "----------------------------------------------------------------"
- puts " You chose: #{index} "
+ puts " ----------------------------------------------------------------"
+ puts " "
+ puts " You chose: #{index} "
puts "
- Name: #{coin.name}
- Currency Symbol: #{coin.symbol}
- Current Price: $#{coin.price}
- 24h Change: #{coin.change}%
- MarketCap: $#{coin.marketcap}"
- puts "----------------------------------------------------------------"
+ Name: #{coin.name}
+ Currency Symbol: #{coin.symbol}
+ Current Price: #{coin.price}
+ 24h Change: #{coin.change}%
+ MarketCap: #{coin.marketcap}"
+ puts " "
+ puts " ----------------------------------------------------------------"
2.times do
puts " "
end
end
\ No newline at end of file