lib/ratebeer/style.rb
def scrape_beers
      @beers = beer_list.css('tr').drop(1).map do |row|
        cells = row.css('td')
        url   = cells[1].at_css('a')['href']
        [cells[0].text.to_i, Beer::Beer.new(url.split('/').last,
                                            name: fix_characters(cells[1].text))]
      end.to_h
    end
# Each key represents an item of data accessible for each beer, and defines
# dynamically a series of methods for accessing this data.
#
Each key represents an item of data accessible for each beer, and defines
dynamically a series of methods for accessing this data.
Each key represents an item of data accessible for each beer and defines dynamically a series of methods for accessing this data .
def scrape_beers
      @beers = beer_list.css('tr').drop(1).map do |row|
        cells = row.css('td')
        url   = cells[1].at_css('a')['href']
        [cells[0].text.to_i, Beer::Beer.new(url.split('/').last,
                                            name: fix_characters(cells[1].text))]
      end.to_h
    end
def scrape_beers @beers = beer_list . css ( 'tr' ) . drop ( 1 ) . map do | row | cells = row . css ( 'td' ) url = cells [ 1 ] . at_css ( 'a' ) [ 'href' ] [ cells [ 0 ] . text . to_i , Beer :: Beer . new ( url . split ( '/' ) . last , name : fix_characters ( cells [ 1 ] . text ) ) ] end . to_h end
Each key represents an item of data accessible for each beer, and defines
dynamically a series of methods for accessing this data.
Each key represents an item of data accessible for each beer and defines dynamically a series of methods for accessing this data .