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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 5c5bd7fbe035ba01409e39e038fa49d88efab4b9
4
- data.tar.gz: 9d61e58456b71a6dc47ad06afae313c19b19a45d
2
+ SHA256:
3
+ metadata.gz: 204af73dc3865471933519436bd143356f61205a797d447e7698fe2cf24663b2
4
+ data.tar.gz: f13684cdf11caf2c62925d289c7e063dbd17b29801974c5eba747f8965ae885f
5
5
  SHA512:
6
- metadata.gz: 6a9ed3142cad3571762c1b97119752ef1ff5669e04650c5e0ee10a5199c62e73dafa2d871c32df7c33d7cc6abe5f01d4b76dcc0bf84ae6fef4c1978817f7063e
7
- data.tar.gz: 2de288110357ba6bdd75d1868517330e633d1140d7cd84ba0bcfaa95295eae6a5e04fd466ae7288b4d600b06ac4075ff10b1948dfd3084980a711303a41af62f
6
+ metadata.gz: 65b9a5568132724e10ca50dd9612066911ab537f25b274f9976921343302f9d5fbbd7c4591c6bf34660d7a93f86e905807e1e7a6b9df6011d8480f64cdb7d371
7
+ data.tar.gz: 8465687a9bdc7db632547452c7b0535dfe16c36dea5a170a544ecaed459f0e5e74cc2b5f55233b86ef2642266ed87b294b9031ec4afdeca33c4cefd15211a07f
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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 = build_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.2.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
- MIIDXjCCAkagAwIBAgIBATANBgkqhkiG9w0BAQUFADAsMSowKAYDVQQDDC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zcm9iZXJ0
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: 2018-03-09 00:00:00.000000000 Z
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.7'
46
+ version: '1.8'
42
47
  - - ">="
43
48
  - !ruby/object:Gem::Version
44
- version: 1.7.29
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.7'
56
+ version: '1.8'
52
57
  - - ">="
53
58
  - !ruby/object:Gem::Version
54
- version: 1.7.29
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.4'
66
+ version: '1.6'
62
67
  - - ">="
63
68
  - !ruby/object:Gem::Version
64
- version: 1.4.6
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.4'
76
+ version: '1.6'
72
77
  - - ">="
73
78
  - !ruby/object:Gem::Version
74
- version: 1.4.6
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.3.7
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.3.7
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.1
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.1
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.6.13
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