lib/dutch_top40/cli.rb in dutch_top40-0.1.0 vs lib/dutch_top40/cli.rb in dutch_top40-0.1.1

- old
+ new

@@ -11,43 +11,38 @@ def list_songs @songs = DutchTop40::Songs.list print_songs puts - end def print_songs + binding.pry @songs.each.with_index(1) do |song, index| - puts "#{index}. #{song.values[0]}" + puts "#{index}. #{song.title}" end end - def menu - + def menu input = nil - while input != 'exit' puts "Which song do you want more info on? Type list to see list again, type exit to quit.","" input = gets.strip.downcase case input.to_i when 1..@songs.size puts "Current rank #{input}." - puts "#{@songs[input.to_i-1].values[0]} - performing artist(s): #{@songs[input.to_i-1].values[1]}" - puts "weeks listed: #{@songs[input.to_i-1].values[2]} - last weeks rank #{@songs[input.to_i-1].values[3]}","" + puts "#{@songs[input.to_i-1].title} - performing artist(s): #{@songs[input.to_i-1].name}" + puts "weeks listed: #{@songs[input.to_i-1].listed} - last weeks rank #{@songs[input.to_i-1].last_weeks_rank}","" else puts "Invalid input!" unless input == 'exit' || input == 'list' if input == 'list' print_songs end if input == 'exit' goodbye end end - end - - end def goodbye logo puts "See you next time..." \ No newline at end of file