lib/ratebeer/brewery/beer_list.rb
def process_rating_info(row)
        cell_indices = { avg_rating:      4,
                         style_rating:    5,
                         num_ratings:     6 }
        rating = cell_indices.map do |attr, i|
          val = row.css('td')[i].text.gsub(nbsp, ' ').strip
          conversion = attr == :avg_rating ? :to_f : :to_i
          [attr, val.send(conversion)]
        end
        rating.to_h
      end
# Processes rating information from a beer row.
Processes rating information from a beer row.
Processes rating information from a beer row .
def process_rating_info(row)
        cell_indices = { avg_rating:      4,
                         style_rating:    5,
                         num_ratings:     6 }
        rating = cell_indices.map do |attr, i|
          val = row.css('td')[i].text.gsub(nbsp, ' ').strip
          conversion = attr == :avg_rating ? :to_f : :to_i
          [attr, val.send(conversion)]
        end
        rating.to_h
      end
def process_rating_info ( row ) cell_indices = { avg_rating : 4 , style_rating : 5 , num_ratings : 6 } rating = cell_indices . map do | attr , i | val = row . css ( 'td' ) [ i ] . text . gsub ( nbsp , ' ' ) . strip conversion = attr == :avg_rating ? :to_f : :to_i [ attr , val . send ( conversion ) ] end rating . to_h end
Processes rating information from a beer row.
Processes rating information from a beer row .
row