Class: AustinsTopYogaStudios::Studio
- Inherits:
-
Object
- Object
- AustinsTopYogaStudios::Studio
- Defined in:
- lib/Austins_Top_Yoga_Studios/studio.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#paragraph ⇒ Object
Returns the value of attribute paragraph.
Class Method Summary collapse
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/Austins_Top_Yoga_Studios/studio.rb', line 3 def name @name end |
#paragraph ⇒ Object
Returns the value of attribute paragraph.
3 4 5 |
# File 'lib/Austins_Top_Yoga_Studios/studio.rb', line 3 def paragraph @paragraph end |
Class Method Details
.all ⇒ Object
20 21 22 |
# File 'lib/Austins_Top_Yoga_Studios/studio.rb', line 20 def self.all self.scrape_and_create_from_page end |
.scrape_and_create_from_page ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/Austins_Top_Yoga_Studios/studio.rb', line 6 def self.scrape_and_create_from_page yogas = [] doc = Nokogiri::HTML(open("https://fitt.co/austin/incredible-studios-practice-yoga-austin/")) s = doc.css("li.list-loop__item") s.each do |studios| studio = self.new studio.name = studios.css("h2.h2.list-loop__title").text studio.paragraph = studios.css("div.list-loop__description.t-content").text.strip yogas << studio end yogas end |