best-nomad-cities 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/best_nomad_cities/city.rb +21 -19
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 92f33468eac7eb1d083fbc45ebfdf096b2b708b5
4
- data.tar.gz: 786012d5adac6edb26621490ae510d1ea6cfbf9d
3
+ metadata.gz: cc6864265f8a5103c58e46d5cfa4659a374f9e50
4
+ data.tar.gz: bb2c9cf2b91567323a2919e0e4f1a46ab00b3cc8
5
5
  SHA512:
6
- metadata.gz: 952cf0dbd1df953edaa10144ac427254fe17ea445e680ce5a768f61eee61c83fa18d00c3885e1d5bf11bb2861576b99fd3b12db8f3d6394baa519327f1b8dfa1
7
- data.tar.gz: d45c68e71ada9a0819f2f688220be8e88b8155249209dae2566c381e03c0c88391532a341ecb326a607d5c20e7318bcfd703cbad144643bbe0b7e8c0a8c8a7a0
6
+ metadata.gz: 381684ad1c18f1a99c1c63e023dc0f856f4aa5231bab50977ae1b6a8cfc4af688308a955ac18c0b739d927bd15a29aa3366bef21acc41764e94ef33dc0108e50
7
+ data.tar.gz: 68b205671eb64b98e0460ca62c7d7258f9da23de5ebc9d1a683a1870b23db45d845f4175f9a699c698fb03c79174b78b11b4eadead0277a95dcc21df93048557
@@ -4,27 +4,29 @@ class BestNomadCities::City
4
4
  @@all = []
5
5
 
6
6
  def self.new_from_home_page(city)
7
- self.new(
8
- city.css("h2").text,
9
- city.css("h3").text,
10
- city.css(".rank").text,
11
- city.css(".bottom-right").text,
12
- city.css(".top-right").text,
13
- "#{city.css(".metric").text} / #{city.css(".imperial").text}",
14
- city.css('a').attribute('href').value,
15
- "#{city.css('a').attribute('href').value}/travel-guide"
16
- )
7
+ attrs = {
8
+ name: city.css("h2").text,
9
+ country: city.css("h3").text,
10
+ rank: city.css(".rank").text,
11
+ cost: city.css(".bottom-right").text,
12
+ internet_speed: city.css(".top-right").text,
13
+ weather: "#{city.css(".metric").text} / #{city.css(".imperial").text}",
14
+ link: city.css('a').attribute('href').value,
15
+ tg_link: "#{city.css('a').attribute('href').value}/travel-guide"
16
+ }
17
+
18
+ self.new(attrs)
17
19
  end
18
20
 
19
- def initialize(name = nil, country = nil, rank = nil, cost = nil, internet_speed = nil, weather = nil, link = nil, tg_link = nil )
20
- @name = name
21
- @country = country
22
- @rank = rank
23
- @cost = cost
24
- @internet_speed = internet_speed
25
- @weather = weather
26
- @link = link
27
- @tg_link = tg_link
21
+ def initialize(attrs)
22
+ @name = attrs[:name]
23
+ @country = attrs[:country]
24
+ @rank = attrs[:rank]
25
+ @cost = attrs[:cost]
26
+ @internet_speed = attrs[:internet_speed]
27
+ @weather = attrs[:weather]
28
+ @link = attrs[:link]
29
+ @tg_link = attrs[:tg_link]
28
30
  @@all << self
29
31
  end
30
32
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: best-nomad-cities
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henno Fourie