class PitchforkReviews::CLI
Public Instance Methods
call()
click to toggle source
# File lib/pitchfork_reviews/cli.rb, line 3 def call list_reviews menu goodbye end
goodbye()
click to toggle source
# File lib/pitchfork_reviews/cli.rb, line 59 def goodbye puts "Goodbye! Check back again soon for more new albums." end
list_reviews()
click to toggle source
# File lib/pitchfork_reviews/cli.rb, line 9 def list_reviews puts puts "Welcome! Here are the most recent album reviews from Pitchfork." puts @albums = PitchforkReviews::Album.scrape_pitchfork @albums.each.with_index(1) do |album, i| puts "#{i}. #{album.name} by #{album.artist}#{album.best_new_album}" end puts end
sort_by_score()
click to toggle source
# File lib/pitchfork_reviews/cli.rb, line 20 def sort_by_score @albums = PitchforkReviews::Album.scrape_pitchfork @albums.sort! { |a,b| b.score <=> a.score} @albums.each.with_index(1) do |album, i| puts "#{i}. #{album.name} by #{album.artist}#{album.best_new_album}, #{album.score}" end end