<file_sep>class CLI


    def start
puts "welcome to the Billboard top 10 app."
    end
    ##
    #
end<file_sep>require "nokogiri"
require "pry"
require "open-uri"

require_relative "../lib/scraper"
require_relative "../lib/artist"
require_relative "../lib/cli"<file_sep>class Artist

    @@all = []
    
    attr_accessor :name, :song,  
    def self.create_from_hash(hash)
        a = Artist.new
        hash.each do |key, value|
          a.send("#{key}=", value) if a.methods.include?("#{key}=".to_sym)
        end
        a.save
      end
    
      def self.all
        @@all
      end
    
      def save
        @@all << self
    
        self
      end
    
      def info
        <<~INFO
        Name: #{name}
        
        Song: #{song}
        INFO
      end
    
    end

   
# puts "The number #{artist.position} this month is #{artist.name} with the song: #{artist.song}"
end<file_sep>#!/usr/bin/env ruby
require_relative "../config/environment"

# CLI.new.start
CLI.new.create_artist<file_sep>
require "pry"
require "nokogiri"
require "open-uri"

class Scraper

    def scrape_top_artist

        site = "https://www.billboard.com/charts/hot-100"
        doc = Nokogiri::HTML(open(site))
        results = doc.css('li span.chart-element__information')

        results.each do |row|
            artist_hash = {}
        artist_hash["name"] = artist_doc.css('span')[0].text.strip
        artist_hash["song"] = artist_doc.css('span')[1].text.strip
        end 

    end


end



# the first artist doc.css(".chart-list__element").first.css("span").map {|x| x.text}<file_sep>class CLI


    def start
        Scraper.new.scrape_top_artist

puts "welcome to the Billboard top 10 app."
main_menu
    end

    def main_menu
        puts "please select an option"
        puts ""
        puts "1. list Artist"
        puts "2. exit"
        main_menu_options
    end

    def main_menu_options
        input = gets.strip

        case input
        when "1"
            scraper.new.scrape_top_artist
            list_artist
        when "2"
             goodbye
        else 
            puts "that was not one of the options, please try again"
            main_menu
        end
    end
def goodbye
    puts "come again soon"
end

   # def create_artist
       # artist = Artist.new(Scraper.scrape_top_artist)
        binding.pry
    end

end<file_sep>#!/usr/bin/env ruby


    CLI.new.start