sof-cycle 0.1.15 → 0.1.17

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ace7e7bdb57808f1c633cf78aaab4fc7949e6820e86089c283926e0c22558bbd
4
- data.tar.gz: 5c12b7d8d840f2afe367d13cc7e5864fd835d62e2f0b9bc480d17873e706182c
3
+ metadata.gz: 578b47e1063361f57d1d3eee18543b7dc16665ccbc0e5c6f7684405699a406ff
4
+ data.tar.gz: 365a22eff32c6908fcfbdbe14f6d0494c77c70c8471b9af13e0e76ce32945bf5
5
5
  SHA512:
6
- metadata.gz: d1c8dda915931d2a5cd860ebf1ad79d2c6cc353d8794a159cc52720bde02f2e3e3aa7001fbb7af240dbf16c1b212f44ce28eacb7ec10fa1868dd47c7860406ae
7
- data.tar.gz: ea2ca6604e38d85894d0df757010449f839040b28c01de608270cdffc536ed5f8e62125ecea7ec59f9100106eae6a3ab2a3243b68b4218a7269b671f483e9bad
6
+ metadata.gz: 944184b46dc341d087db96a0173ad72de8a8524fd8984c34efd3e7b53853fefd68d0f0814cedf5818cb74492e3c69556bc90174227a3bf1001a867db7d60de37
7
+ data.tar.gz: 49f3369f577e9369ca19f3f6f3b0f37fb9ec558a9aac48e5af6ec4429e85d1561c27591b039b3263cf3531f62185829a0a03a10fe5bb565ed4f36e29206c4f10
data/CHANGELOG.md CHANGED
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [0.1.15] - 2026-07-27
8
+ ## [0.1.17] - 2026-10-20
9
9
 
10
- ## [0.1.14] - 2026-04-27
10
+ ### Changed
11
+
12
+ - `Cycle#reset_by` re-anchors the window on the date that meets the cycle's volume, and later dates count toward the new window
13
+
14
+ ## [0.1.16] - 2026-10-08
15
+
16
+ ### Added
17
+
18
+ - `Cycle#activated_by(date)` returns the cycle anchored on that date, or itself when already active
@@ -0,0 +1 @@
1
+ c566d1094fde450d0b42a5014f89d077cbae3c1a23f0535ac21e16d9fc3d23151c7651a403d4e4f292384187b47188218e7baa78189c98d582a6f45da918aa9c
@@ -0,0 +1 @@
1
+ a2fb7da5b2f320e581a7473ce5e534841d7b6daff56f2bdc3023d439ea4566df96c87edd4cf116348f4cac4a16db140b1edb5b45098cee73bcd63d7cb566baf5
@@ -2,6 +2,6 @@
2
2
 
3
3
  module SOF
4
4
  class Cycle
5
- VERSION = "0.1.15"
5
+ VERSION = "0.1.17"
6
6
  end
7
7
  end
data/lib/sof/cycle.rb CHANGED
@@ -310,10 +310,12 @@ module SOF
310
310
  # consuming app.
311
311
  #
312
312
  # Dates on or before the current anchor are ignored: a back-dated act
313
- # must not drag a forward-running window backwards. Every other kind
314
- # returns itself — a lookback window already slides, a calendar window is
315
- # pinned to the calendar, a one-shot window does not repeat, and an
316
- # un-anchored one has no window to move until it is activated.
313
+ # must not drag a forward-running window backwards. The window re-anchors
314
+ # on the date that meets its volume; later dates count toward the new
315
+ # window. Every other kind returns itself — a lookback window already
316
+ # slides, a calendar window is pinned to the calendar, a one-shot window
317
+ # does not repeat, and an un-anchored one has no window to move until it
318
+ # is activated.
317
319
  #
318
320
  # @param dates [Array<Date, Time, nil>] the acts that satisfy this cycle
319
321
  # @return [Cycle] the reset cycle, or self when nothing resets it
@@ -329,6 +331,21 @@ module SOF
329
331
  reset ? Cycle.for(activated_notation(reset)) : self
330
332
  end
331
333
 
334
+ # The cycle anchored on `date`. A cycle already active — anchored, or of
335
+ # a kind that is never dormant — returns itself.
336
+ #
337
+ # @param date [Date, Time] the act that anchors this cycle
338
+ # @return [Cycle] the activated cycle, or self when already active
339
+ #
340
+ # @example
341
+ # Cycle.for("V1E24M").activated_by(Date.new(2025, 4, 17))
342
+ # # => Cycle.for("V1E24MF2025-04-17")
343
+ def activated_by(date)
344
+ return self if active?
345
+
346
+ Cycle.for(activated_notation(date))
347
+ end
348
+
332
349
  # From the supplied anchor date, are there enough in-window completions to
333
350
  # satisfy the cycle?
334
351
  #
@@ -382,10 +399,19 @@ module SOF
382
399
 
383
400
  private
384
401
 
385
- # The latest date that moves this cycle's window forward, or nil.
386
402
  def reset_date(dates)
387
- anchored_on = from_date.to_date
388
- Array(dates).filter_map { it&.to_date }.select { it > anchored_on }.max
403
+ anchor = from_date.to_date
404
+ reset = nil
405
+ counted = 0
406
+ Array(dates).filter_map { it&.to_date }.sort.each do |date|
407
+ next unless date > anchor
408
+ counted += 1
409
+ next if counted < volume
410
+
411
+ anchor = reset = date
412
+ counted = 0
413
+ end
414
+ reset
389
415
  end
390
416
  end
391
417
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sof-cycle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Gay
@@ -57,6 +57,8 @@ files:
57
57
  - checksums/sof-cycle-0.1.12.gem.sha512
58
58
  - checksums/sof-cycle-0.1.13.gem.sha512
59
59
  - checksums/sof-cycle-0.1.14.gem.sha512
60
+ - checksums/sof-cycle-0.1.15.gem.sha512
61
+ - checksums/sof-cycle-0.1.16.gem.sha512
60
62
  - checksums/sof-cycle-0.1.2.gem.sha512
61
63
  - checksums/sof-cycle-0.1.3.gem.sha512
62
64
  - checksums/sof-cycle-0.1.4.gem.sha512