Class: WhatAWorld::Scraper::ScraperCountry
- Inherits:
-
Object
- Object
- WhatAWorld::Scraper::ScraperCountry
- Defined in:
- lib/what_a_world/scraper.rb
Instance Attribute Summary collapse
-
#country_page ⇒ Object
Returns the value of attribute country_page.
-
#region ⇒ Object
writeonly
Sets the attribute region.
Instance Method Summary collapse
- #find_date ⇒ Object
- #find_region ⇒ Object
-
#initialize(url_extension) ⇒ ScraperCountry
constructor
A new instance of ScraperCountry.
Constructor Details
#initialize(url_extension) ⇒ ScraperCountry
Returns a new instance of ScraperCountry.
46 47 48 49 50 |
# File 'lib/what_a_world/scraper.rb', line 46 def initialize(url_extension) country_url = URL + url_extension html = open(country_url) @country_page = Nokogiri::HTML(html) end |
Instance Attribute Details
#country_page ⇒ Object
Returns the value of attribute country_page.
44 45 46 |
# File 'lib/what_a_world/scraper.rb', line 44 def country_page @country_page end |
#region=(value) ⇒ Object (writeonly)
Sets the attribute region
45 46 47 |
# File 'lib/what_a_world/scraper.rb', line 45 def region=(value) @region = value end |
Instance Method Details
#find_date ⇒ Object
52 53 54 |
# File 'lib/what_a_world/scraper.rb', line 52 def find_date self.country_page.css("div.lastMod").text.strip end |
#find_region ⇒ Object
55 56 57 58 |
# File 'lib/what_a_world/scraper.rb', line 55 def find_region str = self.country_page.css("div.region1.geos_title").text.strip self.region = str.split(" ")[0] end |