british_suntimes 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/british_suntimes.rb +18 -5
- metadata +45 -40
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 204af73dc3865471933519436bd143356f61205a797d447e7698fe2cf24663b2
|
4
|
+
data.tar.gz: f13684cdf11caf2c62925d289c7e063dbd17b29801974c5eba747f8965ae885f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65b9a5568132724e10ca50dd9612066911ab537f25b274f9976921343302f9d5fbbd7c4591c6bf34660d7a93f86e905807e1e7a6b9df6011d8480f64cdb7d371
|
7
|
+
data.tar.gz: 8465687a9bdc7db632547452c7b0535dfe16c36dea5a170a544ecaed459f0e5e74cc2b5f55233b86ef2642266ed87b294b9031ec4afdeca33c4cefd15211a07f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/british_suntimes.rb
CHANGED
@@ -12,14 +12,18 @@ require 'solareventcalculator'
|
|
12
12
|
|
13
13
|
class BritishSuntimes
|
14
14
|
|
15
|
-
attr_reader :to_h, :bst_start, :bst_end, :to_dx
|
15
|
+
attr_reader :to_h, :bst_start, :bst_end, :to_dx, :longest_day, :shortest_day
|
16
16
|
|
17
17
|
|
18
|
-
def initialize(year=Date.today.year.to_s, location: 'edinburgh'
|
18
|
+
def initialize(year=Date.today.year.to_s, location: 'edinburgh',
|
19
|
+
debug: false)
|
20
|
+
|
21
|
+
@debug = debug
|
19
22
|
|
20
23
|
a = (Date.parse(year + ' Jan')...Date.parse(year.succ + ' Jan')).to_a
|
21
24
|
g = Geocoder.search(location)
|
22
25
|
|
26
|
+
puts 'finding the times ...' if @debug
|
23
27
|
times = a.inject({}) do |r, date|
|
24
28
|
|
25
29
|
calc = SolarEventCalculator.new(date, *g[0].coordinates)
|
@@ -47,7 +51,8 @@ class BritishSuntimes
|
|
47
51
|
end
|
48
52
|
|
49
53
|
@year, @location, @to_h = year, location, times
|
50
|
-
@to_dx
|
54
|
+
puts 'buklding @to_dx' if @debug
|
55
|
+
@to_dx = build_dx()
|
51
56
|
|
52
57
|
end
|
53
58
|
|
@@ -62,14 +67,22 @@ class BritishSuntimes
|
|
62
67
|
def build_dx()
|
63
68
|
|
64
69
|
dx = Dynarex.new 'times[title, tags, desc, bst_start, ' +
|
65
|
-
'bst_end]/day(date, sunrise, sunset)'
|
70
|
+
'bst_end, longest_day, shortest_day]/day(date, sunrise, sunset)'
|
66
71
|
dx.title = @location + " sunrise sunset times " + @year
|
67
72
|
dx.tags = @location + " times sunrise sunset %s" % [@year]
|
68
73
|
dx.delimiter = ' # '
|
69
74
|
dx.bst_start, dx.bst_end = @bst_start.to_s, @bst_end.to_s
|
70
75
|
dx.desc = 'Adjusted for British summertime'
|
71
76
|
|
72
|
-
@to_h.each {|k,v| dx.create date: k, sunrise: v[0], sunset: v[1] }
|
77
|
+
@to_h.each {|k,v| dx.create date: k, sunrise: v[0], sunset: v[1] }
|
78
|
+
|
79
|
+
a = dx.all.map do |x|
|
80
|
+
Time.parse(x.date + ' ' + x.sunset) - Time.parse(x.date + ' ' + x.sunrise)
|
81
|
+
end
|
82
|
+
|
83
|
+
shortest, longest = a.minmax.map {|x| dx.all[a.index(x)]}
|
84
|
+
@longest_day = dx.longest_day = longest.date
|
85
|
+
@shortest_day = dx.shortest_day = shortest.date
|
73
86
|
|
74
87
|
dx
|
75
88
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: british_suntimes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,27 +10,32 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
/
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjAwNjExMTAwMjEyWhcN
|
15
|
+
MjEwNjExMTAwMjEyWjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDNufQS
|
17
|
+
GLHSuUH9HUgyomaXbTd18xjZJxP1hWOTd7sTz9N1Wh3GknbhPxuOgpEBDonE6G7V
|
18
|
+
0XTmfR9zeBIbSiqlOwCYHzyBgTl8GAy7NkbmwVxsSzi+MYi9LG/GcGyPF7s9cZoX
|
19
|
+
PtHdwBNTpaLvAAZPHXIguQzAzjJrPT5klPCBjmUuWFZNiKO0Vz5JGieWc4OxXWjq
|
20
|
+
ZKvfnROPx9yaxHvnLC9Q+qjhoBXJ0qaOFOyOjC/+7j1xpQ1cCsXpxAGS7lgZG3tz
|
21
|
+
i1Yk3S0aZk/17Tk3NJTezLfbLbER4ZKPt1PpFCdvIFmTDMts0eHn5iy54UQjqf8M
|
22
|
+
LeoW10RP6GtCVtVOKDts56GULQzaM2BA8cgvcC/BB5kThpeeZsxZ/QRt0GG7efw6
|
23
|
+
5UeviY9GwUnXk26fRyOS9oachkD9RAEmvPlvht8RIHlULxO5QyFSUxPVB3Jp83AI
|
24
|
+
xvfnQrQsyfB7szJkTx64jyCWtbdCeS/pzUj4kXl9bbLQN4LhelSQOHTByoMCAwEA
|
25
|
+
AaOBijCBhzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUqKaRzjqM
|
26
|
+
Z26/XznHosYxOVl6hHgwJgYDVR0RBB8wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
|
27
|
+
c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
|
28
|
+
BgkqhkiG9w0BAQsFAAOCAYEAOtYVDVUUFnififbN/33fi7CacBBJahZPLtmRHHCI
|
29
|
+
hj+jktjxExSzadlXFoHZGIQrzmxOxeiykWzp2WOspEOr89FBixPrHyMjAQgYhznx
|
30
|
+
eGvg97lCt4/CHqGriq5ooxWQDeBHJ5jQZ0aLD+A9JCid7nihuarLhug0MxcOLUSQ
|
31
|
+
SYGCa34/JU+7WIBcBjOroa1BayDvplBsZ/o1RI+VJVI2Pp1LbCCxvu26TxmVvr4L
|
32
|
+
MuDxL8327ifowO7RD1GHGvWApktuB8tge8oXlWD0c6mWY6O5nvIpg5WhrhaOCr08
|
33
|
+
/EF5hf5BY7Q6idbSk73ZzgTNiGl8Re8NmbqPcfgW7yBll7AkQAFcHf+T/i8Qm6Ou
|
34
|
+
YfVRxMpn5tyUHZm78cMWzlZAfdOhEt4zdhLaR40X9S6Tb0hYZL2/mXrdt+Fv/ZXK
|
35
|
+
KZN/b4pHsTmdPvX4FdARJnnEUtrZpQErp0HIyLfW10yzYEn+v1OV/ZBBhn7IULYU
|
36
|
+
myp4h0d9AUO6AR3JalFRJBFy
|
32
37
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
38
|
+
date: 2020-06-11 00:00:00.000000000 Z
|
34
39
|
dependencies:
|
35
40
|
- !ruby/object:Gem::Dependency
|
36
41
|
name: dynarex
|
@@ -38,60 +43,60 @@ dependencies:
|
|
38
43
|
requirements:
|
39
44
|
- - "~>"
|
40
45
|
- !ruby/object:Gem::Version
|
41
|
-
version: '1.
|
46
|
+
version: '1.8'
|
42
47
|
- - ">="
|
43
48
|
- !ruby/object:Gem::Version
|
44
|
-
version: 1.
|
49
|
+
version: 1.8.24
|
45
50
|
type: :runtime
|
46
51
|
prerelease: false
|
47
52
|
version_requirements: !ruby/object:Gem::Requirement
|
48
53
|
requirements:
|
49
54
|
- - "~>"
|
50
55
|
- !ruby/object:Gem::Version
|
51
|
-
version: '1.
|
56
|
+
version: '1.8'
|
52
57
|
- - ">="
|
53
58
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
59
|
+
version: 1.8.24
|
55
60
|
- !ruby/object:Gem::Dependency
|
56
61
|
name: geocoder
|
57
62
|
requirement: !ruby/object:Gem::Requirement
|
58
63
|
requirements:
|
59
64
|
- - "~>"
|
60
65
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1.
|
66
|
+
version: '1.6'
|
62
67
|
- - ">="
|
63
68
|
- !ruby/object:Gem::Version
|
64
|
-
version: 1.
|
69
|
+
version: 1.6.3
|
65
70
|
type: :runtime
|
66
71
|
prerelease: false
|
67
72
|
version_requirements: !ruby/object:Gem::Requirement
|
68
73
|
requirements:
|
69
74
|
- - "~>"
|
70
75
|
- !ruby/object:Gem::Version
|
71
|
-
version: '1.
|
76
|
+
version: '1.6'
|
72
77
|
- - ">="
|
73
78
|
- !ruby/object:Gem::Version
|
74
|
-
version: 1.
|
79
|
+
version: 1.6.3
|
75
80
|
- !ruby/object:Gem::Dependency
|
76
81
|
name: chronic_cron
|
77
82
|
requirement: !ruby/object:Gem::Requirement
|
78
83
|
requirements:
|
79
|
-
- - "~>"
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: '0.3'
|
82
84
|
- - ">="
|
83
85
|
- !ruby/object:Gem::Version
|
84
|
-
version: 0.
|
86
|
+
version: 0.6.0
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.6'
|
85
90
|
type: :runtime
|
86
91
|
prerelease: false
|
87
92
|
version_requirements: !ruby/object:Gem::Requirement
|
88
93
|
requirements:
|
89
|
-
- - "~>"
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
version: '0.3'
|
92
94
|
- - ">="
|
93
95
|
- !ruby/object:Gem::Version
|
94
|
-
version: 0.
|
96
|
+
version: 0.6.0
|
97
|
+
- - "~>"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0.6'
|
95
100
|
- !ruby/object:Gem::Dependency
|
96
101
|
name: RubySunrise
|
97
102
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,7 +106,7 @@ dependencies:
|
|
101
106
|
version: '0.3'
|
102
107
|
- - ">="
|
103
108
|
- !ruby/object:Gem::Version
|
104
|
-
version: 0.3.
|
109
|
+
version: 0.3.3
|
105
110
|
type: :runtime
|
106
111
|
prerelease: false
|
107
112
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -111,7 +116,7 @@ dependencies:
|
|
111
116
|
version: '0.3'
|
112
117
|
- - ">="
|
113
118
|
- !ruby/object:Gem::Version
|
114
|
-
version: 0.3.
|
119
|
+
version: 0.3.3
|
115
120
|
description:
|
116
121
|
email: james@jamesrobertson.eu
|
117
122
|
executables: []
|
@@ -139,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
144
|
version: '0'
|
140
145
|
requirements: []
|
141
146
|
rubyforge_project:
|
142
|
-
rubygems_version: 2.
|
147
|
+
rubygems_version: 2.7.10
|
143
148
|
signing_key:
|
144
149
|
specification_version: 4
|
145
150
|
summary: Generates the British sunrise and sunset times.
|
metadata.gz.sig
CHANGED
Binary file
|