fuelprice 0.1.0 → 0.1.1
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.
- data/Manifest +1 -0
- data/fuelprice.gemspec +1 -1
- data/lib/fuelprice.rb +9 -7
- metadata +3 -3
data/Manifest
CHANGED
data/fuelprice.gemspec
CHANGED
data/lib/fuelprice.rb
CHANGED
|
@@ -4,24 +4,26 @@ require 'hpricot'
|
|
|
4
4
|
|
|
5
5
|
module Fuelprice
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
VERSION = File.open(File.join(File.dirname(__FILE__), '..', 'VERSION'), 'r') { |f| f.read.strip }
|
|
8
|
+
|
|
9
|
+
class Fuelprice
|
|
8
10
|
|
|
9
11
|
attr_accessor :url
|
|
10
12
|
|
|
11
13
|
|
|
12
14
|
# Initialize a new Fuelprice object with the url of the dutch newssite www.nu.nl/brandstof
|
|
13
|
-
# fuelprice = Fuelprice::Fuelprice.new
|
|
14
|
-
|
|
15
|
+
# fuelprice = Fuelprice::Fuelprice.new
|
|
16
|
+
|
|
15
17
|
def initialize
|
|
16
18
|
@url = "http://www.nu.nl/brandstof"
|
|
17
19
|
end
|
|
18
20
|
|
|
19
21
|
def gasoline
|
|
20
|
-
document.search("#gasprices tr[3]/td[2]/b").innerHTML.
|
|
22
|
+
document.search("#gasprices tr[3]/td[2]/b").innerHTML.to_f
|
|
21
23
|
end
|
|
22
|
-
|
|
24
|
+
|
|
23
25
|
def oil
|
|
24
|
-
document.search("#gasprices tr[5]/td[2]/b").innerHTML.
|
|
26
|
+
document.search("#gasprices tr[5]/td[2]/b").innerHTML.to_f
|
|
25
27
|
end
|
|
26
28
|
|
|
27
29
|
private
|
|
@@ -29,6 +31,6 @@ module Fuelprice
|
|
|
29
31
|
@document ||= Hpricot(open(self.url))
|
|
30
32
|
end
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
end
|
|
33
35
|
|
|
34
36
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fuelprice
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 25
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 1
|
|
9
|
-
-
|
|
10
|
-
version: 0.1.
|
|
9
|
+
- 1
|
|
10
|
+
version: 0.1.1
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Joost Saanen
|