Class: Destinations::TravelDestinationsLists
- Inherits:
-
Object
- Object
- Destinations::TravelDestinationsLists
- Defined in:
- lib/destinations/travel_destinations.rb
Class Method Summary collapse
- .puts_cities ⇒ Object
- .puts_countries ⇒ Object
- .puts_regions ⇒ Object
- .puts_value ⇒ Object
- .scrape_cities ⇒ Object
- .scrape_countries ⇒ Object
- .scrape_list ⇒ Object
- .scrape_regions ⇒ Object
- .scrape_value ⇒ Object
Class Method Details
.puts_cities ⇒ Object
35 36 37 38 39 |
# File 'lib/destinations/travel_destinations.rb', line 35 def self.puts_cities self.scrape_cities.css(".marketing-article__header h1").each do |lists| puts lists.text end end |
.puts_countries ⇒ Object
29 30 31 32 33 |
# File 'lib/destinations/travel_destinations.rb', line 29 def self.puts_countries self.scrape_countries.css(".marketing-article__header h1").each do |lists| puts lists.text end end |
.puts_regions ⇒ Object
41 42 43 44 45 |
# File 'lib/destinations/travel_destinations.rb', line 41 def self.puts_regions self.scrape_regions.css(".marketing-article__header h1").each do |lists| puts lists.text end end |
.puts_value ⇒ Object
48 49 50 51 52 |
# File 'lib/destinations/travel_destinations.rb', line 48 def self.puts_value self.scrape_value.css(".marketing-article__header h1").each do |lists| puts lists.text end end |
.scrape_cities ⇒ Object
16 17 18 |
# File 'lib/destinations/travel_destinations.rb', line 16 def self.scrape_cities Nokogiri::HTML(open("https://www.lonelyplanet.com/best-in-travel/cities")).css(".marketing-article") end |
.scrape_countries ⇒ Object
12 13 14 |
# File 'lib/destinations/travel_destinations.rb', line 12 def self.scrape_countries Nokogiri::HTML(open("https://www.lonelyplanet.com/best-in-travel/countries")).css(".marketing-article") end |
.scrape_list ⇒ Object
5 6 7 8 9 10 |
# File 'lib/destinations/travel_destinations.rb', line 5 def self.scrape_list Nokogiri::HTML(open("https://www.lonelyplanet.com/best-in-travel/")).css("a.js-page-navigation-spot span").each_with_index do |list, index| puts "#{index+1}. #{list.text}" end puts "5. List of All Destinations" end |
.scrape_regions ⇒ Object
20 21 22 |
# File 'lib/destinations/travel_destinations.rb', line 20 def self.scrape_regions Nokogiri::HTML(open("https://www.lonelyplanet.com/best-in-travel/regions")).css(".marketing-article") end |
.scrape_value ⇒ Object
24 25 26 |
# File 'lib/destinations/travel_destinations.rb', line 24 def self.scrape_value Nokogiri::HTML(open("https://www.lonelyplanet.com/best-in-travel/value")).css(".marketing-article") end |