british_suntimes 0.4.0 → 0.5.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
2
  SHA256:
3
- metadata.gz: e31bfb164e63efe50333e5f978407ccf986cf3a75790381226a0ea58a098677b
4
- data.tar.gz: 8bc2366559d43a75dda383affaaef0bf5c5f6fe3b58deb85024aaa03bf513204
3
+ metadata.gz: 1216b26e7c62951c228d8cfa7f3fd731d53b08cad84802da98135541cc5e3f30
4
+ data.tar.gz: cfce6f3a0054424bca50e8a28c2e1c55ed9d25b77e190f3c16791c6a85a9bbe9
5
5
  SHA512:
6
- metadata.gz: aa68395c9d21f404c265b5b05107e781809b92e5b7351fba3fa8fb09792cf47fa4427d069d7d80f1b16d672583db4c13ad7cdfe3fc9a3ef87c547277a4063b9a
7
- data.tar.gz: 50e928228ed848f69021d58ace156375584d765e4600ccf19242e2278ea04203ff4e851730dabb4be4124e2a3749eab70ef396fb798439090eb797404012a204
6
+ metadata.gz: c71b48736907a9a093043573ff6dec821db92775b95681ce3098a31b38d19406ac8ae25912e3e647d97b183dd21cf82fbffee8dcee5f6c1fcfd33ac52b600678
7
+ data.tar.gz: 0b11a55f64a5b059af12711a10827d2a43a03efea137c8fa695760baace1c3e00395a320f519ed67ece3ceab9eea6f360aebfe8e4628d75fef9a076a0b6524df
checksums.yaml.gz.sig CHANGED
Binary file
@@ -18,9 +18,9 @@ class BritishSuntimes
18
18
  attr_reader :to_h, :bst_start, :bst_end, :to_dx, :longest_day, :shortest_day
19
19
 
20
20
 
21
- def initialize(year=Date.today.year.to_s, location: 'edinburgh',
21
+ def initialize(year=Date.today.year.to_s, location: 'edinburgh',
22
22
  debug: false)
23
-
23
+
24
24
  @location, @debug = location, debug
25
25
 
26
26
  a = (Date.parse(year + ' Jan')...Date.parse(year.succ + ' Jan')).to_a
@@ -41,9 +41,9 @@ class BritishSuntimes
41
41
 
42
42
  # alter the times for British summertime
43
43
 
44
- @bst_start = ChronicCron.new('last sunday in March at 1am',
44
+ @bst_start = ChronicCron.new('last sunday in March at 1am',
45
45
  Time.local(year)).to_date
46
- @bst_end = ChronicCron.new('last sunday in October at 2am',
46
+ @bst_end = ChronicCron.new('last sunday in October at 2am',
47
47
  Time.local(year)).to_date
48
48
 
49
49
 
@@ -55,21 +55,21 @@ class BritishSuntimes
55
55
 
56
56
  @year, @location, @to_h = year, location, times
57
57
  puts 'buklding @to_dx' if @debug
58
- @to_dx = build_dx()
59
-
58
+ @to_dx = build_dx()
59
+
60
60
  end
61
-
61
+
62
62
  # exports the sun times to a raw Dynarex file
63
63
  #
64
64
  def export(filename=@location + "-suntimes-#{@year}.txt")
65
65
  File.write filename, @to_dx.to_s
66
- end
67
-
66
+ end
67
+
68
68
  private
69
-
69
+
70
70
  def build_dx()
71
71
 
72
- dx = Dynarex.new 'times[title, tags, desc, bst_start, ' +
72
+ dx = Dynarex.new 'times[title, tags, desc, bst_start, ' +
73
73
  'bst_end, longest_day, shortest_day]/day(date, sunrise, sunset)'
74
74
  dx.title = @location + " sunrise sunset times " + @year
75
75
  dx.tags = @location + " times sunrise sunset %s" % [@year]
@@ -77,28 +77,28 @@ class BritishSuntimes
77
77
  dx.bst_start, dx.bst_end = @bst_start.to_s, @bst_end.to_s
78
78
  dx.desc = 'Adjusted for British summertime'
79
79
 
80
- @to_h.each {|k,v| dx.create date: k, sunrise: v[0], sunset: v[1] }
81
-
82
- a = dx.all.map do |x|
80
+ @to_h.each {|k,v| dx.create({date: k, sunrise: v[0], sunset: v[1]}) }
81
+
82
+ a = dx.all.map do |x|
83
83
  Time.parse(x.date + ' ' + x.sunset) - Time.parse(x.date + ' ' + x.sunrise)
84
84
  end
85
85
 
86
- shortest, longest = a.minmax.map {|x| dx.all[a.index(x)]}
86
+ shortest, longest = a.minmax.map {|x| dx.all[a.index(x)]}
87
87
  @longest_day = dx.longest_day = longest.date
88
88
  @shortest_day = dx.shortest_day = shortest.date
89
-
89
+
90
90
  dx
91
- end
91
+ end
92
92
 
93
93
  end
94
94
 
95
95
  class BritishSuntimesAgent < BritishSuntimes
96
96
  using HumanSpeakable
97
- using Ordinals
97
+ using Ordinals
98
+
98
99
 
99
-
100
100
  def longest_day()
101
-
101
+
102
102
  d = super()
103
103
  days = (Date.parse(d) - Date.today).to_i
104
104
  sunrise, sunset = to_dx().to_h[d]
@@ -113,10 +113,13 @@ class BritishSuntimesAgent < BritishSuntimes
113
113
  day = d2.strftime("#{d2.day.ordinal} %B")
114
114
 
115
115
  s = d2.humanize
116
- msg = s[0].upcase + s[1..-1] + " (%s), is the longest day of the year when #%s will enjoy %s of sunshine. The sun will rise at %sam and set at %spm." % [day, @location, duration, t1.strftime("%-I:%M"), t2.strftime("%-I:%M")]
117
-
116
+ msg = s[0].upcase + s[1..-1] + ", the longest day of the year, #%s \
117
+ will enjoy %s of sunshine. The sun will rise at %sam \
118
+ and set at %spm." % [@location, duration, t1.strftime("%-I:%M"), \
119
+ t2.strftime("%-I:%M")]
120
+
118
121
  end
119
-
122
+
120
123
  end
121
124
 
122
125
 
data.tar.gz.sig CHANGED
Binary file
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.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -11,31 +11,31 @@ cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
13
  MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
14
- YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjAwNjExMTAwMjEyWhcN
15
- MjEwNjExMTAwMjEyWjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
16
- cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDNufQS
17
- GLHSuUH9HUgyoma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FdARJnnEUtrZpQErp0HIyLfW10yzYEn+v1OV/ZBBhn7IULYU
36
- myp4h0d9AUO6AR3JalFRJBFy
28
+ BgkqhkiG9w0BAQsFAAOCAYEAF2UDw3TXBk/1o9VNI3TKnfvluH7sKYON0h3oXAU6
29
+ iU7Dh2sp+v/tSFpvHhNC1PCzq4Y8sIrNOQrGHmTvan6kFqf9YFsN16jNtVlZzv6V
30
+ 3couH2Tfb9Tw/kxPOz18sNz5EimXf01lnjK7QFzgrtTUwJ5BGj7781IYN/XpytZ9
31
+ v59XTGxwNKdKWLT0dVI57j3yEHV88e8P1UPRaEEcZmV9Qxm/iGuAyKF7Fd2x91j5
32
+ qatVoadW1TpYTcfZXQr5B6qwAdn6LT2QCfr1h8tTLp0975kbojr0i/PQW2aDPQH5
33
+ IFIKW3ML1zCL9CRhBtCgXDtqnVg8IRBKW8T1XsEnveDtywyECDRDX0jkv5oM5ZWO
34
+ csOuxXIf8sq4OG5FCXoWb2GDk5TwUQx2/kGhflzf+0a/2sf98tSYerGzYeobAlS9
35
+ FW4AJTaOjuf5+cYOQjF3Di+9vB/yLrtvGk4Be/xxiWpo0DNyql5byYIyD5vt8Ce2
36
+ 6MBcxBvjf/Cxj/wrZclExElj
37
37
  -----END CERTIFICATE-----
38
- date: 2020-06-11 00:00:00.000000000 Z
38
+ date: 2022-02-07 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: dynarex
@@ -43,60 +43,60 @@ dependencies:
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '1.8'
46
+ version: '1.9'
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 1.8.24
49
+ version: 1.9.2
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '1.8'
56
+ version: '1.9'
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: 1.8.24
59
+ version: 1.9.2
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: geocoder
62
62
  requirement: !ruby/object:Gem::Requirement
63
63
  requirements:
64
64
  - - "~>"
65
65
  - !ruby/object:Gem::Version
66
- version: '1.6'
66
+ version: '1.7'
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: 1.6.3
69
+ version: 1.7.3
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '1.6'
76
+ version: '1.7'
77
77
  - - ">="
78
78
  - !ruby/object:Gem::Version
79
- version: 1.6.3
79
+ version: 1.7.3
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: chronic_cron
82
82
  requirement: !ruby/object:Gem::Requirement
83
83
  requirements:
84
- - - ">="
85
- - !ruby/object:Gem::Version
86
- version: 0.6.0
87
84
  - - "~>"
88
85
  - !ruby/object:Gem::Version
89
- version: '0.6'
86
+ version: '0.7'
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 0.7.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.6.0
97
94
  - - "~>"
98
95
  - !ruby/object:Gem::Version
99
- version: '0.6'
96
+ version: '0.7'
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: 0.7.1
100
100
  - !ruby/object:Gem::Dependency
101
101
  name: RubySunrise
102
102
  requirement: !ruby/object:Gem::Requirement
@@ -121,22 +121,22 @@ dependencies:
121
121
  name: subunit
122
122
  requirement: !ruby/object:Gem::Requirement
123
123
  requirements:
124
- - - ">="
125
- - !ruby/object:Gem::Version
126
- version: 0.5.0
127
124
  - - "~>"
128
125
  - !ruby/object:Gem::Version
129
- version: '0.5'
126
+ version: '0.8'
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: 0.8.5
130
130
  type: :runtime
131
131
  prerelease: false
132
132
  version_requirements: !ruby/object:Gem::Requirement
133
133
  requirements:
134
- - - ">="
135
- - !ruby/object:Gem::Version
136
- version: 0.5.0
137
134
  - - "~>"
138
135
  - !ruby/object:Gem::Version
139
- version: '0.5'
136
+ version: '0.8'
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: 0.8.5
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: human_speakable
142
142
  requirement: !ruby/object:Gem::Requirement
@@ -158,7 +158,7 @@ dependencies:
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0.2'
160
160
  description:
161
- email: james@jamesrobertson.eu
161
+ email: digital.robertson@gmail.com
162
162
  executables: []
163
163
  extensions: []
164
164
  extra_rdoc_files: []
metadata.gz.sig CHANGED
Binary file