et-orbi 1.2.6 → 1.2.8

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: 187fde2e940f4644e296f434208de71ceeced5bacd257fcc7a799e08e5b3fc2f
4
- data.tar.gz: 7c9425490c4cb365453031032faa159fe1111d5bc606a2ad88d7a3cede16d660
3
+ metadata.gz: 149c5b95f1f67702640cb1b202d768bec7e215bb6335f9ec73f247d65edb6298
4
+ data.tar.gz: 6e559b757f53c60daef8be08c9c9af0d48378e203cc3d7cbb5582b4bb758b051
5
5
  SHA512:
6
- metadata.gz: 00f33cb173d79780c87e68d16e4ba64187f37ac9bde5eeafef7169846a597bf1708eeb6cf053d18b74a3030d84c0bfa8ced97898edc9ec5a4886b8470e41d31c
7
- data.tar.gz: a5878f8ae60c18404c53d38a58b347916236138af79c90c8a35fb170fc559e85d89336b08b6ea4453a9001b9a4405c8df8aeeed126202f4e6d379d2a443e20ca
6
+ metadata.gz: 58d548986bc13f557c88cb862f52c10faa9211489a0daa0de7691eea5473905554a3257166d689c128d1a14d97c000713de17ee5064c557eaf601f718ee26b2b
7
+ data.tar.gz: 4919107bc2091bb8be87af751e86f75bf99f5f29fae457f12321b85bfc38ec38ad47a533e4a706f27bbd409b0bd92e479c9f44b9b01f5dc2adc18a839b2232cc
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
  # CHANGELOG.md
3
3
 
4
4
 
5
+ ## et-orbi 1.2.8 released 2024-03-11 (13 years)
6
+
7
+ - Cache the @ref time used in the #rweek and #rday computation
8
+
9
+
10
+ ## et-orbi 1.2.7 released 2022-03-09
11
+
12
+ - Fix the wday_in_month computation for floraison/fugit#67
13
+
14
+
5
15
  ## et-orbi 1.2.6 released 2021-10-30
6
16
 
7
17
  - Favour IANA timezone name in EtOrbi.make_time
data/CREDITS.md CHANGED
@@ -1,6 +1,10 @@
1
1
 
2
2
  # et-orbi credits
3
3
 
4
+ * Igor Viktor https://github.com/gogainda gh-34
5
+ * phibid, for https://github.com/floraison/fugit/issues/67
6
+ * Peter Goldstein, https://github.com/petergoldstein GHA 3.3 j9.3, gh-32
7
+ * harsha-flipp (https://github.com/harsha-flipp) https://github.com/floraison/fugit/issues/63
4
8
  * adank92 (https://github.com/adank92) https://github.com/ondrejbartas/sidekiq-cron/issues/276 gh-28
5
9
  * Stan Hu (https://github.com/stanhu) Chronic toubles, gh-24, gh-26, etc
6
10
  * d-m-u (https://github.com/d-m-u) EoTime#==(Time), gh-20, gh-7
data/LICENSE.txt CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- Copyright (c) 2017-2021, John Mettraux, jmettraux+flor@gmail.com
2
+ Copyright (c) 2017-2024, John Mettraux, jmettraux+flor@gmail.com
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
5
  of this software and associated documentation files (the "Software"), to deal
data/Makefile CHANGED
@@ -1,10 +1,10 @@
1
1
 
2
2
  ## gem tasks ##
3
3
 
4
- NAME = \
5
- $(shell ruby -e "s = eval(File.read(Dir['*.gemspec'][0])); puts s.name")
6
- VERSION = \
7
- $(shell ruby -e "s = eval(File.read(Dir['*.gemspec'][0])); puts s.version")
4
+ NAME != \
5
+ ruby -e "s = eval(File.read(Dir['*.gemspec'][0])); puts s.name"
6
+ VERSION != \
7
+ ruby -e "s = eval(File.read(Dir['*.gemspec'][0])); puts s.version"
8
8
 
9
9
  count_lines:
10
10
  find lib -name "*.rb" | xargs cat | ruby -e "p STDIN.readlines.count { |l| l = l.strip; l[0, 1] != '#' && l != '' }"
data/README.md CHANGED
@@ -3,7 +3,6 @@
3
3
 
4
4
  [![tests](https://github.com/floraison/et-orbi/workflows/test/badge.svg)](https://github.com/floraison/et-orbi/actions)
5
5
  [![Gem Version](https://badge.fury.io/rb/et-orbi.svg)](http://badge.fury.io/rb/et-orbi)
6
- [![Join the chat at https://gitter.im/floraison/fugit](https://badges.gitter.im/floraison/fugit.svg)](https://gitter.im/floraison/fugit?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
7
6
 
8
7
  Time zones for [fugit](https://github.com/floraison/fugit) and for [rufus-scheduler](https://github.com/jmettraux/rufus-scheduler). Urbi et Orbi.
9
8
 
data/lib/et-orbi/time.rb CHANGED
@@ -101,6 +101,8 @@ module EtOrbi
101
101
  def zone=(z)
102
102
 
103
103
  @time = nil
104
+ @ref = nil
105
+
104
106
  @zone = self.class.get_tzone(zone || :current)
105
107
  end
106
108
 
@@ -326,19 +328,26 @@ module EtOrbi
326
328
 
327
329
  def wday_in_month
328
330
 
329
- [ count_weeks(-1), - count_weeks(1) ]
331
+ [ count_weeks(EtOrbi.make_time(strftime('%F 12:00:00 %/Z')), -1),
332
+ - count_weeks(EtOrbi.make_time(strftime('%F 12:00:00 %/Z')) , 1) ]
330
333
  end
331
334
 
335
+ # "reference week", used in fugit for cron modulo notation
336
+ #
332
337
  def rweek
333
338
 
334
- ((self - EtOrbi.make_time('2019-01-01 00:00:00', @zone)) / WEEK_S)
335
- .floor + 1
339
+ @ref ||= EtOrbi.make_time('2019-01-01 00:00:00', @zone)
340
+
341
+ ((self - @ref) / WEEK_S).floor + 1
336
342
  end
337
343
 
344
+ # "reference week", used in fugit for cron modulo notation
345
+ #
338
346
  def rday
339
347
 
340
- ((self - EtOrbi.make_time('2019-01-01 00:00:00', @zone)) / DAY_S)
341
- .floor + 1
348
+ @ref ||= EtOrbi.make_time('2019-01-01 00:00:00', @zone)
349
+
350
+ ((self - @ref) / DAY_S).floor + 1
342
351
  end
343
352
 
344
353
  def reach(points)
@@ -385,10 +394,11 @@ module EtOrbi
385
394
  @time ||= @zone.utc_to_local(utc)
386
395
  end
387
396
 
388
- def count_weeks(dir)
397
+ def count_weeks(start, dir)
389
398
 
390
399
  c = 0
391
- t = self
400
+ t = start
401
+
392
402
  until t.month != self.month
393
403
  c += 1
394
404
  t += dir * (7 * 24 * 3600)
data/lib/et-orbi.rb CHANGED
@@ -13,6 +13,6 @@ require 'et-orbi/zone'
13
13
 
14
14
  module EtOrbi
15
15
 
16
- VERSION = '1.2.6'
16
+ VERSION = '1.2.8'
17
17
  end
18
18
 
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.6
4
+ version: 1.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-29 00:00:00.000000000 Z
11
+ date: 2024-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tzinfo
@@ -82,7 +82,7 @@ metadata:
82
82
  bug_tracker_uri: https://github.com/floraison/et-orbi/issues
83
83
  homepage_uri: https://github.com/floraison/et-orbi
84
84
  source_code_uri: https://github.com/floraison/et-orbi
85
- post_install_message:
85
+ post_install_message:
86
86
  rdoc_options: []
87
87
  require_paths:
88
88
  - lib
@@ -97,8 +97,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
99
  requirements: []
100
- rubygems_version: 3.1.2
101
- signing_key:
100
+ rubygems_version: 3.2.33
101
+ signing_key:
102
102
  specification_version: 4
103
103
  summary: time with zones
104
104
  test_files: []