et-orbi 1.2.8 → 1.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/CREDITS.md +2 -0
- data/lib/et-orbi/time.rb +42 -20
- data/lib/et-orbi.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 435f9eb2e9b27822b9ee161fbe2449375cb710e1e01b8f3313c61983424aba85
|
4
|
+
data.tar.gz: a72603974625eb4e8c49e89c3a317002ea8661adbaa461c2d143450bd8b9c40a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b45a1917c605b29254c97d5ab27d1b5e894cb2e9ed01b27594a19b8a52fc16c18fe6f59d56a362cedc0e0d3131278ec2d0d288427a132ce2b5152a7b0404ab22
|
7
|
+
data.tar.gz: dd28bbd9b3fe1ad3feb0088284a01f909453afd1ae56ba3c910215d85d9af793fdf3042adc27fa1789bc646412abb2643f0543c1b7bb2fa8e02aa50a57771f33
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,12 @@
|
|
2
2
|
# CHANGELOG.md
|
3
3
|
|
4
4
|
|
5
|
-
## et-orbi 1.2.
|
5
|
+
## et-orbi 1.2.9 released 2024-03-13
|
6
|
+
|
7
|
+
- Refine #rweek computation, aim at noon instead of midnight, gh-38
|
8
|
+
|
9
|
+
|
10
|
+
## et-orbi 1.2.8 released 2024-03-11 (13 ans)
|
6
11
|
|
7
12
|
- Cache the @ref time used in the #rweek and #rday computation
|
8
13
|
|
data/CREDITS.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
|
2
2
|
# et-orbi credits
|
3
3
|
|
4
|
+
* Benjami Darcet @bdarcet https://github.com/floraison/fugit/issues/67 gh-38
|
5
|
+
* @franckduche https://github.com/floraison/fugit/issues/67 gh-38
|
4
6
|
* Igor Viktor https://github.com/gogainda gh-34
|
5
7
|
* phibid, for https://github.com/floraison/fugit/issues/67
|
6
8
|
* Peter Goldstein, https://github.com/petergoldstein GHA 3.3 j9.3, gh-32
|
data/lib/et-orbi/time.rb
CHANGED
@@ -88,22 +88,34 @@ module EtOrbi
|
|
88
88
|
(defined?(TZInfo::Data) ? '' : "\nand adding gem 'tzinfo-data'")
|
89
89
|
) unless @zone
|
90
90
|
|
91
|
+
touch
|
92
|
+
end
|
93
|
+
|
94
|
+
# Nullify the "caches" used by #to_time, #rweek, and others
|
95
|
+
#
|
96
|
+
def touch
|
97
|
+
|
91
98
|
@time = nil
|
92
|
-
|
99
|
+
@ref = nil
|
93
100
|
end
|
94
101
|
|
95
102
|
def seconds=(f)
|
96
103
|
|
97
|
-
@time = nil
|
98
104
|
@seconds = f
|
105
|
+
|
106
|
+
touch
|
107
|
+
|
108
|
+
f
|
99
109
|
end
|
100
110
|
|
101
111
|
def zone=(z)
|
102
112
|
|
103
|
-
@time = nil
|
104
|
-
@ref = nil
|
105
113
|
|
106
114
|
@zone = self.class.get_tzone(zone || :current)
|
115
|
+
|
116
|
+
touch
|
117
|
+
|
118
|
+
@zone
|
107
119
|
end
|
108
120
|
|
109
121
|
# Returns true if this EoTime instance corresponds to 2 different UTC
|
@@ -232,8 +244,8 @@ module EtOrbi
|
|
232
244
|
def <=(o); @seconds <= _to_f(o); end
|
233
245
|
def <=>(o); @seconds <=> _to_f(o); end
|
234
246
|
|
235
|
-
def add(t); @
|
236
|
-
def subtract(t); @
|
247
|
+
def add(t); @seconds += t.to_f; touch; self; end
|
248
|
+
def subtract(t); @seconds -= t.to_f; touch; self; end
|
237
249
|
|
238
250
|
def +(t); inc(t, 1); end
|
239
251
|
def -(t); inc(t, -1); end
|
@@ -303,19 +315,24 @@ module EtOrbi
|
|
303
315
|
|
304
316
|
def inc(t, dir=1)
|
305
317
|
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
318
|
+
r =
|
319
|
+
case t
|
320
|
+
when Numeric
|
321
|
+
nt = self.dup
|
322
|
+
nt.seconds += dir * t.to_f
|
323
|
+
nt
|
324
|
+
when ::Time, ::EtOrbi::EoTime
|
325
|
+
fail ArgumentError.new(
|
326
|
+
"Cannot add #{t.class} to EoTime") if dir > 0
|
327
|
+
@seconds + dir * t.to_f
|
328
|
+
else
|
329
|
+
fail ArgumentError.new(
|
330
|
+
"Cannot call add or subtract #{t.class} to EoTime instance")
|
331
|
+
end
|
332
|
+
|
333
|
+
touch
|
334
|
+
|
335
|
+
r
|
319
336
|
end
|
320
337
|
|
321
338
|
def localtime(zone=nil)
|
@@ -336,7 +353,7 @@ module EtOrbi
|
|
336
353
|
#
|
337
354
|
def rweek
|
338
355
|
|
339
|
-
@ref ||= EtOrbi.make_time('2019-01-01
|
356
|
+
@ref ||= EtOrbi.make_time('2019-01-01 12:00:00', @zone)
|
340
357
|
|
341
358
|
((self - @ref) / WEEK_S).floor + 1
|
342
359
|
end
|
@@ -382,6 +399,11 @@ module EtOrbi
|
|
382
399
|
t
|
383
400
|
end
|
384
401
|
|
402
|
+
def clone
|
403
|
+
|
404
|
+
EtOrbi::EoTime.new(@seconds, @zone)
|
405
|
+
end
|
406
|
+
|
385
407
|
protected
|
386
408
|
|
387
409
|
# Returns a Ruby Time instance.
|
data/lib/et-orbi.rb
CHANGED
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.2.
|
4
|
+
version: 1.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mettraux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03-
|
11
|
+
date: 2024-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tzinfo
|
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
|
-
rubygems_version: 3.
|
100
|
+
rubygems_version: 3.4.10
|
101
101
|
signing_key:
|
102
102
|
specification_version: 4
|
103
103
|
summary: time with zones
|