class ReligioCLI::CLI

Public Instance Methods

call() click to toggle source
# File lib/religio_cli/cli.rb, line 3
def call
  ReligioCLI::Scraper.initiate_scraper
  puts "Hello there! Welcome to Religio. I offer information on the top 50 Major Religious traditions. To see the list presented in alphabetical order, enter 'list'. To exit, enter 'exit'."
  input = nil
  input = gets.strip.downcase
  if input == "list"
      list_religions
      menu
  elsif input == "exit"
    goodbye
    exit
  else
    puts "I'm not sure what you'd like. Please see the below the list:"
    list_religions
    menu
  end
end
display_religion(integer) click to toggle source
# File lib/religio_cli/cli.rb, line 27
def display_religion(integer)
  user_selection = ReligioCLI::Trads.all[integer-1]
  puts " "
  puts user_selection.name.upcase
  puts " "
  puts user_selection.quick_facts
  puts " "
  puts "#{user_selection.description}"
  puts " "
  puts "To learn more, visit:"
  puts user_selection.url
end
goodbye() click to toggle source
# File lib/religio_cli/cli.rb, line 74
def goodbye
  puts "Thanks for exploring! I hope you learned something cool today. Feel free to stop by anytime :)"
end
list_religions() click to toggle source
# File lib/religio_cli/cli.rb, line 21
def list_religions
  ReligioCLI::Trads.all.each.with_index(1) do |religion, index|
    puts "#{index}. #{religion.name}"
  end
end
menu() click to toggle source