class DanceTime::CLI
Public Instance Methods
call()
click to toggle source
# File lib/dance_time/cli.rb, line 3 def call puts "" puts "Welcome to the Best YouTube Dance Channels!" puts "" puts "Type list to see our list of channels" input = gets.strip.downcase if input == "list" DanceTime::Scraper.new.make_channels start else call end end
channel_list()
click to toggle source
# File lib/dance_time/cli.rb, line 39 def channel_list DanceTime::Channel.all.each.with_index(1) do |channel, i| puts "#{i}. #{channel.name}" end end
channel_profile(channel)
click to toggle source
# File lib/dance_time/cli.rb, line 45 def channel_profile(channel) puts "" puts "~~~#{channel.name} Profile: ~~~" puts "" puts "About: #{channel.about}" puts "YouTube Link: #{channel.youtube_link}" puts "Frequency: #{channel.frequency.gsub(/^Frequency - /, "")}" puts "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" end
start()
click to toggle source
# File lib/dance_time/cli.rb, line 17 def start channel_list puts "Here's a list of channels, scroll up to see the full list." puts "Type the number of the channel you'd like more info on." input = gets.strip.to_i channel = DanceTime::Channel.find(input) channel_profile(channel) puts "Would you like to see more? y/n" input = gets.strip.downcase if input == "y" || input == "yes" start elsif input == "n" || input == "exit" puts "Thanks for playing. Goodbye!" exit else puts "Please try again" sleep 3 start end end