class ArtThroughoutTheYears::CLI
Public Instance Methods
call()
click to toggle source
# File lib/cli.rb, line 3 def call ArtThroughoutTheYears::Scraper.scrape_art start list_pieces print_artwork end
list_pieces()
click to toggle source
# File lib/cli.rb, line 16 def list_pieces puts "To see a list of works of art type list.".bold.italic.blue input = gets.strip if input =="list" puts "" works = ArtThroughoutTheYears::WorksofArt.all.each.with_index(1) do |work, index| puts "#{index}) #{work.title}".cyan end end end
next_choice()
click to toggle source
# File lib/cli.rb, line 46 def next_choice puts "Please enter another number of the listed work or enter exit to leave the program.".bold.italic.blue input = gets.strip if input.to_i < 24 work = ArtThroughoutTheYears::WorksofArt.find(input.to_i) puts "" puts "Work: --#{work.title.bold.cyan}--" puts "" puts "Information: --#{work.description}--" puts "" next_choice elsif input == "exit" puts "Thank you for visiting, have a nice day!".bold.italic.blue else next_choice end end
print_artwork()
click to toggle source
# File lib/cli.rb, line 27 def print_artwork puts "Please enter the number of the listed work you would like to view or exit.".bold.italic.blue input = gets.strip if input.to_i < 24 work = ArtThroughoutTheYears::WorksofArt.find(input.to_i) puts "" puts "Work: --#{work.title.bold.cyan}--" puts "" puts "Information: --#{work.description}--" puts "" next_choice elsif input == "exit" puts "Thank you for visiting!".bold.italic.blue else input.to_i > 23 puts "Please enter a valid number of listed work." print_artwork end end
start()
click to toggle source
# File lib/cli.rb, line 10 def start puts "" puts "-------- ~The Most Popular Paintings in History~ --------".bold.underline.green puts "" end