Class: StrangerThingsDirectory::LocationScraper
- Inherits:
-
Object
- Object
- StrangerThingsDirectory::LocationScraper
- Defined in:
- lib/stranger_things_directory/location_scraper.rb
Instance Attribute Summary collapse
-
#doc ⇒ Object
Returns the value of attribute doc.
-
#locations ⇒ Object
Returns the value of attribute locations.
-
#urls_list ⇒ Object
Returns the value of attribute urls_list.
Instance Method Summary collapse
Instance Attribute Details
#doc ⇒ Object
Returns the value of attribute doc.
2 3 4 |
# File 'lib/stranger_things_directory/location_scraper.rb', line 2 def doc @doc end |
#locations ⇒ Object
Returns the value of attribute locations.
2 3 4 |
# File 'lib/stranger_things_directory/location_scraper.rb', line 2 def locations @locations end |
#urls_list ⇒ Object
Returns the value of attribute urls_list.
2 3 4 |
# File 'lib/stranger_things_directory/location_scraper.rb', line 2 def urls_list @urls_list end |
Instance Method Details
#get_locations ⇒ Object
11 12 13 14 15 |
# File 'lib/stranger_things_directory/location_scraper.rb', line 11 def get_locations self.open_page.css("div#WikiaArticle.WikiaArticle ul.category-page__trending-pages li.category-page__trending-page") #binding.pry end |
#open_page ⇒ Object
6 7 8 9 |
# File 'lib/stranger_things_directory/location_scraper.rb', line 6 def open_page Nokogiri::HTML(open("https://strangerthings.fandom.com/wiki/Category:Locations")) #binding.pry end |
#send_locations ⇒ Object
16 17 18 19 20 21 |
# File 'lib/stranger_things_directory/location_scraper.rb', line 16 def send_locations get_locations.each do |location| StrangerThingsDirectory::Locations.new_location(location) end end |