Class: HappyHour::Bar
- Inherits:
-
Object
- Object
- HappyHour::Bar
- Defined in:
- lib/happy_hour/bars.rb
Constant Summary collapse
- @@bars =
[]
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Bar
constructor
A new instance of Bar.
Constructor Details
#initialize ⇒ Bar
Returns a new instance of Bar.
7 8 9 10 |
# File 'lib/happy_hour/bars.rb', line 7 def initialize @@bars << self end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/happy_hour/bars.rb', line 3 def description @description end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/happy_hour/bars.rb', line 3 def name @name end |
Class Method Details
.all ⇒ Object
12 13 14 |
# File 'lib/happy_hour/bars.rb', line 12 def self.all @@bars end |
.scrape_bars ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/happy_hour/bars.rb', line 16 def self. 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 || = HappyHour::Bar.new .name = .css('h2').text .description = .css('p').text #binding.pry end end |