Top Level Namespace

Defined Under Namespace

Modules: Podcastme Classes: CLI, Podcast, Scraper

Instance Method Summary collapse

Instance Method Details

#select_podcast_by_indexObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# 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