et-orbi 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/et-orbi.rb +25 -17
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a73f3948e76c89fdb79154e903e590594eadee8
|
4
|
+
data.tar.gz: '068a020b01766dad22cad3e2b0f3d20a612ceaaf'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 256b38da4dd9788c36d6499ff06e29915f5ee80413112a7bf5a9d5b678ac1b6a9fc520de4d5234a34c727adde6e5e0fe02cf815b37927d839e87271eda46ed66
|
7
|
+
data.tar.gz: fe1b1a1bf20569bfe2a2c96d94bd3b9ed32c75a3df400622fef34d907ac20b4c154d055f4e3a991171655e685b40b3c84cc2b2687634bba28d6583c65312a54b
|
data/CHANGELOG.md
CHANGED
data/lib/et-orbi.rb
CHANGED
@@ -7,7 +7,7 @@ require 'tzinfo'
|
|
7
7
|
|
8
8
|
module EtOrbi
|
9
9
|
|
10
|
-
VERSION = '1.0.
|
10
|
+
VERSION = '1.0.7'
|
11
11
|
|
12
12
|
#
|
13
13
|
# module methods
|
@@ -30,7 +30,7 @@ module EtOrbi
|
|
30
30
|
begin
|
31
31
|
DateTime.parse(str)
|
32
32
|
rescue
|
33
|
-
fail ArgumentError, "
|
33
|
+
fail ArgumentError, "No time information in #{str.inspect}"
|
34
34
|
end #if rold
|
35
35
|
#
|
36
36
|
# is necessary since Time.parse('xxx') in Ruby < 1.9 yields `now`
|
@@ -87,7 +87,7 @@ module EtOrbi
|
|
87
87
|
when Numeric then make_from_numeric(o, zone)
|
88
88
|
when ::EtOrbi::EoTime then make_from_eotime(o, zone)
|
89
89
|
else fail ArgumentError.new(
|
90
|
-
"
|
90
|
+
"Cannot turn #{o.inspect} to a ::EtOrbi::EoTime instance")
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
@@ -95,6 +95,7 @@ module EtOrbi
|
|
95
95
|
|
96
96
|
z =
|
97
97
|
zone ||
|
98
|
+
get_as_tzone(t) ||
|
98
99
|
get_tzone(t.zone) ||
|
99
100
|
get_local_tzone(t)
|
100
101
|
|
@@ -218,21 +219,28 @@ module EtOrbi
|
|
218
219
|
|
219
220
|
def get_local_tzone(t)
|
220
221
|
|
221
|
-
#
|
222
|
-
#
|
223
|
-
#
|
224
|
-
#
|
225
|
-
#
|
226
|
-
#
|
227
|
-
#
|
228
|
-
#
|
229
|
-
#
|
230
|
-
#
|
222
|
+
#lt = local_tzone
|
223
|
+
#lp = lt.period_for_local(t)
|
224
|
+
#ab = lp.abbreviation.to_s
|
225
|
+
#
|
226
|
+
#return lt \
|
227
|
+
# if ab == t.zone
|
228
|
+
#return lt \
|
229
|
+
# if ab.match(/\A[-+]\d{2}(:?\d{2})?\z/) && lp.utc_offset == t.utc_offset
|
230
|
+
#
|
231
|
+
#nil
|
232
|
+
#
|
233
|
+
# keep that in the fridge for now
|
231
234
|
|
232
235
|
l = Time.local(t.year, t.month, t.day, t.hour, t.min, t.sec, t.usec)
|
233
236
|
|
234
237
|
t.zone == l.zone ? local_tzone : nil
|
235
238
|
end
|
239
|
+
|
240
|
+
def get_as_tzone(t)
|
241
|
+
|
242
|
+
t.respond_to?(:time_zone) ? t.time_zone : nil
|
243
|
+
end
|
236
244
|
end
|
237
245
|
|
238
246
|
# Our EoTime class (which quacks like a ::Time).
|
@@ -294,7 +302,7 @@ module EtOrbi
|
|
294
302
|
@zone = self.class.get_tzone(zone || :local)
|
295
303
|
|
296
304
|
fail ArgumentError.new(
|
297
|
-
"
|
305
|
+
"Cannot determine timezone from #{zone.inspect}" +
|
298
306
|
"\n#{EtOrbi.render_nozone_time(s)}" +
|
299
307
|
"\n#{EtOrbi.platform_info.sub(',debian:', ",\ndebian:")}" +
|
300
308
|
"\nTry setting `ENV['TZ'] = 'Continent/City'` in your script " +
|
@@ -479,11 +487,11 @@ module EtOrbi
|
|
479
487
|
nt
|
480
488
|
when ::Time, ::EtOrbi::EoTime
|
481
489
|
fail ArgumentError.new(
|
482
|
-
"
|
490
|
+
"Cannot add #{t.class} to EoTime") if dir > 0
|
483
491
|
@seconds + dir * t.to_f
|
484
492
|
else
|
485
493
|
fail ArgumentError.new(
|
486
|
-
"
|
494
|
+
"Cannot call add or subtract #{t.class} to EoTime instance")
|
487
495
|
end
|
488
496
|
end
|
489
497
|
|
@@ -550,7 +558,7 @@ module EtOrbi
|
|
550
558
|
def _to_f(o)
|
551
559
|
|
552
560
|
fail ArgumentError(
|
553
|
-
"
|
561
|
+
"Comparison of EoTime with #{o.inspect} failed"
|
554
562
|
) unless o.is_a?(EoTime) || o.is_a?(Time)
|
555
563
|
|
556
564
|
o.to_f
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: et-orbi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mettraux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tzinfo
|