myweatherforecast 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/myweatherforecast.rb +15 -5
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af86dccf7ea42e5895c5507c83438800e40e7a52
|
4
|
+
data.tar.gz: d7a8f68980b40d89cfdd3ee6fef3cc22ffffa368
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e9e424e01d72a035fe73e5eeec4d56ab7f3dea40a33a634482c9d9c609002a8d92196564daba2d91bec5a35067ec66aa3eebe61c8f7ace0b03ea29853828640
|
7
|
+
data.tar.gz: e446c90dfc272c3ffb487dddb9a886155ede21040d19ceaf15c0f1c442fc2bde40e238f06b2a0238127db78c2bd4ca616d1a7c7ec13857a20464cf5f9afdf60f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/myweatherforecast.rb
CHANGED
@@ -40,10 +40,10 @@ class MyWeatherForecast
|
|
40
40
|
|
41
41
|
class Day
|
42
42
|
|
43
|
-
def initialize(forecast, tlabel)
|
43
|
+
def initialize(forecast, tlabel, i=nil)
|
44
44
|
|
45
45
|
@forecast = forecast
|
46
|
-
@x = forecast.currently
|
46
|
+
@x = i ? forecast['hourly']['data'][i] : forecast.currently
|
47
47
|
@tlabel = tlabel
|
48
48
|
|
49
49
|
end
|
@@ -54,8 +54,7 @@ class MyWeatherForecast
|
|
54
54
|
i = 0
|
55
55
|
i += 1 until Time.at(@forecast['hourly']['data'][i]['time']).hour \
|
56
56
|
== hour.to_i
|
57
|
-
@
|
58
|
-
self
|
57
|
+
Day.new(@forecast, @tlabel, i)
|
59
58
|
end
|
60
59
|
|
61
60
|
def humidity()
|
@@ -99,8 +98,19 @@ class MyWeatherForecast
|
|
99
98
|
@forecast = forecast
|
100
99
|
@x = forecast['hourly']['data'][index]
|
101
100
|
@tlabel = tlabel
|
101
|
+
@i = index
|
102
102
|
|
103
103
|
end
|
104
|
+
|
105
|
+
def at(raw_hour)
|
106
|
+
|
107
|
+
hour = Time.parse(raw_hour).hour
|
108
|
+
|
109
|
+
i = @i - 12
|
110
|
+
i += 1 until Time.at(@forecast['hourly']['data'][i]['time']).hour \
|
111
|
+
== hour.to_i
|
112
|
+
DaysAhead.new(@forecast, @tlabel, index: i)
|
113
|
+
end
|
104
114
|
|
105
115
|
end
|
106
116
|
|
@@ -119,4 +129,4 @@ class MyWeatherForecast
|
|
119
129
|
DaysAhead.new(@forecast, @tlabel, index: i)
|
120
130
|
end
|
121
131
|
|
122
|
-
end
|
132
|
+
end
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|