Created
October 6, 2013 16:50
-
-
Save ahimmelstoss/6856304 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_relative './jukebox.rb' | |
def run | |
puts "Welcome to Ruby Console Jukebox!" | |
command = "" | |
while command.downcase != "exit" do | |
puts "Enter a command to continue. Type 'help' for a list of commands." | |
command = get_command | |
run_command(command) unless command.downcase == "exit" | |
end | |
end | |
def get_command | |
gets.strip | |
end | |
def run_command(command) | |
case command | |
when "help" | |
show_help | |
else | |
jukebox(command) | |
end | |
end | |
def show_help | |
help = "Never worked a jukebox, eh? Pretty standard. Available commands are:\n | |
'help' - shows this menu\n | |
'list' - lists the whole song library\n | |
or you can enter an artist's name to show that artist's songs\n" | |
puts help | |
end | |
run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment