meteorologist 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/meteorologist.rb +6 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 355054fbfa54484ee183d31e9fb7b803ae5c43b5
|
4
|
+
data.tar.gz: bc9d3fec98955d5cb4f264d5b8788c942cadbc48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c98fa38de275ac6d28ad4da953af647aa241afea481b1420c129da64625f5b25eb49785168386cba023042f949081d81aa7872c9b3dbd478f179d2677d0c5db
|
7
|
+
data.tar.gz: 06cd3f67d6587753506ee554ba1b8bf3acae33b7e5a76a519e0c018afaf08457c341e6e75e8841745fb60dbf88e8112d166ef7e10d496fee1bc827d4640a69e6
|
data/lib/meteorologist.rb
CHANGED
@@ -5,19 +5,19 @@ class Meteorologist
|
|
5
5
|
validate_environment
|
6
6
|
|
7
7
|
@location = location
|
8
|
-
#todo allow forecast at a given time
|
9
|
-
#@time = options.fetch(:forecast_time) { Time.now }
|
10
8
|
@forecaster_class = options.fetch(:forecaster) { Forecaster }
|
11
9
|
@navigator_class = options.fetch(:navigator) { Navigator }
|
12
|
-
@
|
10
|
+
@moon_info_class = options.fetch(:moon_info) { MoonInfo }
|
11
|
+
@forecast_time = options.fetch(:forecast_time) { Time.now }
|
12
|
+
@units = options.fetch(:units) { 'si' } # or 'us' for Imperial units
|
13
13
|
end
|
14
14
|
|
15
15
|
def forecast
|
16
|
-
@forecast ||= @forecaster_class.new(coordinates, units)
|
16
|
+
@forecast ||= @forecaster_class.new(coordinates, units, forecast_time)
|
17
17
|
end
|
18
18
|
|
19
19
|
def moon
|
20
|
-
|
20
|
+
@moon ||= @moon_info_class.new(forecast.moon_phase)
|
21
21
|
end
|
22
22
|
|
23
23
|
def location_name
|
@@ -25,7 +25,7 @@ class Meteorologist
|
|
25
25
|
end
|
26
26
|
|
27
27
|
private
|
28
|
-
attr_reader :location, :units
|
28
|
+
attr_reader :location, :forecast_time, :units
|
29
29
|
|
30
30
|
def coordinates
|
31
31
|
navigator.coordinates
|