Class: TopTenIslandsCliGem::Scraper
- Inherits:
-
Object
- Object
- TopTenIslandsCliGem::Scraper
- Defined in:
- lib/top_ten_islands_cli_gem/scraper.rb
Class Method Summary collapse
Class Method Details
.create_islands ⇒ Object
7 8 9 10 11 |
# File 'lib/top_ten_islands_cli_gem/scraper.rb', line 7 def self.create_islands island_array = get_page.css(" .mainName").map do |island| i = TopTenIslandsCliGem::Island.new(island.text.strip,"https://www.tripadvisor.com#{island.css("a").attribute("href").text}") end end |
.get_island_discription(url = nil) ⇒ Object
13 14 15 |
# File 'lib/top_ten_islands_cli_gem/scraper.rb', line 13 def self.get_island_discription(url=nil) Nokogiri::HTML(open(url)).css(" .ermb_text").css(" .content").text.strip end |
.get_page ⇒ Object
3 4 5 |
# File 'lib/top_ten_islands_cli_gem/scraper.rb', line 3 def self.get_page Nokogiri::HTML(open("https://www.tripadvisor.com/TravelersChoice-Islands")) end |