myweatherforecast 1.0.0 → 1.0.5
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 +30 -12
- metadata +10 -10
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76cbe1a9ee289baf82c0081e2b1f446017a950b811d35ea8b5c087e1f4be23ed
|
4
|
+
data.tar.gz: 05bdc15ba9fcb48a9746b581e2601eb1ac51599e05af17691188b02b902b436f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1529784ef4a4229e7e949781219d02691c5f41096bbbba36f9db747d1f3550e5f54e557e22ab2627e54a4cb493195d3da42c910848e6d9e63ef8372bc3ceafc1
|
7
|
+
data.tar.gz: 8d00c0cfee676ef590c17601b5fe35bfadf01d44e1d2227cbc811ba80ebda3870b707960d8debf8a48d0fee8286af0ccf3e691c652c88ad2141dab2a2a8e70f5
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/myweatherforecast.rb
CHANGED
@@ -94,7 +94,7 @@ class MyWeatherForecast
|
|
94
94
|
|
95
95
|
current_hour = Time.at(@hourly_data[0]['time']).hour + advance
|
96
96
|
|
97
|
-
case current_hour
|
97
|
+
name = case current_hour
|
98
98
|
when 12..17
|
99
99
|
:afternoon
|
100
100
|
when 0..5
|
@@ -107,18 +107,16 @@ class MyWeatherForecast
|
|
107
107
|
:night
|
108
108
|
end
|
109
109
|
|
110
|
+
method(name).call
|
111
|
+
|
110
112
|
end
|
111
113
|
|
112
|
-
def afternoon() period(12, 17) end
|
114
|
+
def afternoon() period(12, 17) end
|
115
|
+
def detail() period(0, 23) end
|
113
116
|
def early_hours() period(0, 5) end
|
114
117
|
|
115
118
|
def emoji()
|
116
119
|
|
117
|
-
h = {
|
118
|
-
'clear-day' => :sun,
|
119
|
-
'partly-cloudy-day' => :sun_behind_cloud
|
120
|
-
}
|
121
|
-
|
122
120
|
h = {
|
123
121
|
'clear-day' => :sun,
|
124
122
|
'clear-night' => :night_with_stars,
|
@@ -128,11 +126,11 @@ class MyWeatherForecast
|
|
128
126
|
'wind' => :leaf_fluttering_in_wind,
|
129
127
|
'fog' => :fog,
|
130
128
|
'cloudy' => :cloud,
|
131
|
-
'partly-cloudy-day' => :
|
129
|
+
'partly-cloudy-day' => :sun_behind_cloud,
|
132
130
|
'partly-cloudy-night' => :cloud
|
133
131
|
}
|
134
132
|
|
135
|
-
Emoji2020.new(h[icon()])
|
133
|
+
Emoji2020.new(h[icon()]).to_s
|
136
134
|
|
137
135
|
end
|
138
136
|
|
@@ -247,13 +245,16 @@ class MyWeatherForecast
|
|
247
245
|
|
248
246
|
end
|
249
247
|
|
248
|
+
def day()
|
249
|
+
Date::ABBR_DAYNAMES[self.time.wday]
|
250
|
+
end
|
251
|
+
|
250
252
|
def to_s
|
251
253
|
|
252
|
-
label = self.time.to_date == Time.now.to_date ? 'Today' :
|
253
|
-
Date::ABBR_DAYNAMES[self.time.wday]
|
254
|
-
|
254
|
+
label = self.time.to_date == Time.now.to_date ? 'Today' : day()
|
255
255
|
mask = @symbols ? "%s: ▽%s ▲%s, %s" : "%s: %s %s, %s"
|
256
256
|
mask % [label, tempmin, tempmax, @x.summary]
|
257
|
+
|
257
258
|
end
|
258
259
|
|
259
260
|
def sunrise()
|
@@ -335,6 +336,23 @@ class MyWeatherForecast
|
|
335
336
|
alias wed wednesday
|
336
337
|
alias thu thursday
|
337
338
|
alias fri friday
|
339
|
+
|
340
|
+
def next_3days()
|
341
|
+
|
342
|
+
days().take(4)[1..-1].map do |x|
|
343
|
+
"%s: %s - %s #{x.emoji} %s" % [x.time.strftime("%a"), x.tempmin,
|
344
|
+
x.tempmax, x.summary]
|
345
|
+
end.join("\n")
|
346
|
+
|
347
|
+
end
|
348
|
+
|
349
|
+
def next_5days()
|
350
|
+
|
351
|
+
days().take(6)[1..-1].map do |x|
|
352
|
+
"%s: %s %s" % [x.time.strftime("%a"), x.tempmax, x.summary]
|
353
|
+
end.join("\n")
|
354
|
+
|
355
|
+
end
|
338
356
|
|
339
357
|
private
|
340
358
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: myweatherforecast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
T8ZItjfCqcG6MNMdmPqplYAqpSJzVB9ucdkrz8Ia5Lf1waJw6Dd0m1zHWYSofIH8
|
36
36
|
HuG3HnRIMQNQE2s1PFtxmX2w
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2020-
|
38
|
+
date: 2020-07-17 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: forecast_io
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
version: '1.6'
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 1.6.
|
69
|
+
version: 1.6.3
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -76,27 +76,27 @@ dependencies:
|
|
76
76
|
version: '1.6'
|
77
77
|
- - ">="
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
version: 1.6.
|
79
|
+
version: 1.6.3
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: emoji2020
|
82
82
|
requirement: !ruby/object:Gem::Requirement
|
83
83
|
requirements:
|
84
|
-
- - ">="
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
version: 0.2.0
|
87
84
|
- - "~>"
|
88
85
|
- !ruby/object:Gem::Version
|
89
86
|
version: '0.2'
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.2.1
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 0.2.0
|
97
94
|
- - "~>"
|
98
95
|
- !ruby/object:Gem::Version
|
99
96
|
version: '0.2'
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 0.2.1
|
100
100
|
description:
|
101
101
|
email: james@jamesrobertson.eu
|
102
102
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|