class HappyHour::Bar
Attributes
description[RW]
name[RW]
Public Class Methods
all()
click to toggle source
# File lib/happy_hour/bars.rb, line 12 def self.all @@bars end
new()
click to toggle source
# File lib/happy_hour/bars.rb, line 7 def initialize @@bars << self end
scrape_bars()
click to toggle source
# File lib/happy_hour/bars.rb, line 16 def self.scrape_bars doc = Nokogiri::HTML(open('https://www.amny.com/eat-and-drink/brooklyn-s-best-bar-deals-happy-hours-free-snacks-games-and-more-1.11756526')) doc.css('.mediaCell').each do |bar| new_bar = HappyHour::Bar.new new_bar.name = bar.css('h2').text new_bar.description = bar.css('p').text #binding.pry end end