class Object

Public Instance Methods

select_podcast_by_index() click to toggle source
# File lib/podcastme/cli.rb, line 16
  def select_podcast_by_index
    puts "Choose the number (1-16) of the podcast would you like to learn more about. Type 'list' to see choices again. Type 'exit' to quit.".blue.bold

    input = $stdin.gets.chomp

    podcast_object = Podcast.find(input)

    if input.to_i.between?(1, 16)
      puts "You chose #{podcast_object.title}".green.bold
      puts "What's it all about?".chomp
      puts "#{podcast_object.summary}".chomp
      puts "Find it here: #{podcast_object.url}".chomp
      select_podcast_by_index
    elsif input == 'list'
      run
    elsif input == "exit"
      puts "Happy Podcasting!".blue.bold
      exit!
    else
      puts "Invalid choice."
      select_podcast_by_index
      # loop
  end

end