Sha256: 497034d1203922d9ea6df89d0f777bdabaf9ba229af37dc6dc2abf234ced46a5
Contents?: true
Size: 1.88 KB
Versions: 1
Compression:
Stored size: 1.88 KB
Contents
class Blockers::CLI def display monkeys = "šµ " * 15 sticks = "š " * 15 puts monkeys + "\n" * 2 puts "Finally a program for you, someone who wants to see the 20 cheapest senior-sized blockers at GoalieMonkey.com without necessarily looking at pictures of them." + "\n" * 2 puts sticks + "\n" * 2 end def blocker_list puts "Here are the blockers (cheapest one first):\n\n" Blockers::Blocker.all.each_with_index do |blocker, i| puts "#{i + 1}. #{blocker.name}" end end def blocker_info(item) puts "\nšš šš šš šš šš" puts "\nYou chose the #{item.name.strip.chomp(".")}." puts "It's listed for #{item.price}." puts "Buy it here: \n#{item.url}" puts "\nšš šš šš šš šš" puts "\nTo regenerate the list, type 'list'.\nTo exit, type 'exit'." input = gets.strip.downcase while input != "exit" && input != "list" puts "š Invalid response; to return to the list, type 'list.'\nTo exit, type 'exit'." input = gets.strip.downcase end if input == "exit" puts "š So long. Keep blocking the pucks. š" elsif input == "list" Blockers::Blocker.delete commence end end def commence Blockers::Blocker.scrape display blocker_list input = nil puts "\nš šµ š š šµ šµ šµ š š š š š š š š š š šµ šµ šµ š š šµ š" puts "\nEnter a blocker's number (1-20) for more info:" input = gets.strip.to_i while !input.between?(1, 20) puts "š Invalid response; please enter the number (1-20) for which you'd like to see more info: " input = gets.strip.to_i end index = input - 1 item = Blockers::Blocker.find(index) blocker_info(item) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
blockers-cli-app-0.1.0 | lib/blockers/cli.rb |