lib/ratebeer/beer.rb
def scrape_rating
        raw_rating = [:overall,
                      :style].zip(doc.css('#_aggregateRating6 div')
                             .select { |d| d['title'] =~ /This figure/ }
                             .map { |d| d['title'].split(':').first.to_f }).to_h
        @rating = raw_rating.merge(ratings:       scrape_misc[:ratings],
                                   weighted_avg:  scrape_misc[:weighted_avg],
                                   mean:          scrape_misc[:mean])
      end
# Each key represents an item of data accessible for each beer. The
# included scraping module defines dynamically a series of methods for
# accessing this data.
#
Each key represents an item of data accessible for each beer. The
included scraping module defines dynamically a series of methods for
accessing this data.
Each key represents an item of data accessible for each beer . The included scraping module defines dynamically a series of methods for accessing this data .
def scrape_rating
        raw_rating = [:overall,
                      :style].zip(doc.css('#_aggregateRating6 div')
                             .select { |d| d['title'] =~ /This figure/ }
                             .map { |d| d['title'].split(':').first.to_f }).to_h
        @rating = raw_rating.merge(ratings:       scrape_misc[:ratings],
                                   weighted_avg:  scrape_misc[:weighted_avg],
                                   mean:          scrape_misc[:mean])
      end
def scrape_rating raw_rating = [ :overall , :style ] . zip ( doc . css ( '#_aggregateRating6 div' ) . select { | d | d [ 'title' ] =~ / This figure / } . map { | d | d [ 'title' ] . split ( ':' ) . first . to_f } ) . to_h @rating = raw_rating . merge ( ratings : scrape_misc [ :ratings ] , weighted_avg : scrape_misc [ :weighted_avg ] , mean : scrape_misc [ :mean ] ) end
Each key represents an item of data accessible for each beer.
Each key represents an item of data accessible for each beer .