sof-cycle 0.1.8 → 0.1.10

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: bcb187376738c3b567bf2bc9fc68bba6f1cb7e766302a897ab272db848b1b081
4
- data.tar.gz: d841689c22f68f7f273d1791feb7753826c3b5c2235deb467fad88ee163ec18f
3
+ metadata.gz: efa206d4535b7a45567f643a71738506a7c5a3f318180cba1d576a618b178877
4
+ data.tar.gz: 3946a1dbfc81ef89d33db3ca0bd1df0fd74dc86cc6aef967055dbdac755afd27
5
5
  SHA512:
6
- metadata.gz: f193e2a83e149315956c99df5efebabfd05c9ade453bb4e4763db1a39870c62c63bae5e6c82379bddd1f07a85a1a6f898fb90d53a753f0936f146efdf6e5f786
7
- data.tar.gz: 7000bd01fd3c3302756b757b406f36ec75db9125a3acf597e5c6fb54ab811356e076b4d45087098db94ffb4d4f0151b33d8bd4ce3c1ebe4e4844ae20029aec66
6
+ metadata.gz: 697ee468ec9ed5a57f2b1e33fa1ae38f865fac62082edca445f263b8862d368017a5ca42667c12bfa45c05853790dcc3163e7577f13ca60c0d8981085cebf4e1
7
+ data.tar.gz: c20956003342ba14086a563430d04370872eff64eec0e63b9c7c153f892fe6973a6c805d95bf31f4ae05e12d566a33709858cb3dd35fc996c54c36851c7ab10e
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 3.4.3
data/CHANGELOG.md CHANGED
@@ -5,20 +5,10 @@ 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.8] - 2025-09-04
8
+ ## [0.1.10] - 2025-09-04
9
9
 
10
- ### Changed
11
-
12
- - Simplified `handles?` logic to do string comparison instead of symbol comparison.
13
-
14
- ## [0.1.7] - 2025-06-09
10
+ ## [0.1.9] - 2025-09-04
15
11
 
16
- ### Added
17
-
18
- - `Cycle#considered_dates` to get the subset of `#covered_dates` that are
19
- considered for the cycle's calculations.
20
-
21
- ### Fixed
12
+ ### Changed
22
13
 
23
- - `Cycles::Lookback.volume_to_delay_expiration` now computes correctly when the
24
- `#considered_dates` is smaller than the `#covered_dates` of the cycle.
14
+ - Make use of scoping for `Cycle.cycle_handlers` to prevent collisions with other Cycle classes.
@@ -0,0 +1 @@
1
+ 3fa79340bfbc44787ee3db5a54f4c67155a90a8fb696a17a91a9a76d9e41c7e4c5bb0993d06657ea18bab82f7d89f3a8d4482a3eceedc91c6e34014ce0d97694
@@ -0,0 +1 @@
1
+ 827bb10a76bdf83a57b26a111b504f2df8506184fc363d6bc8924755db65f87039be4daadddc2b8455928f68e5d81bb174bea63372dbda8c5271341b38bb5094
@@ -2,6 +2,6 @@
2
2
 
3
3
  module SOF
4
4
  class Cycle
5
- VERSION = "0.1.8"
5
+ VERSION = "0.1.10"
6
6
  end
7
7
  end
data/lib/sof/cycle.rb CHANGED
@@ -69,7 +69,7 @@ module SOF
69
69
  raise InvalidInput, "'#{notation}' is not a valid input"
70
70
  end
71
71
 
72
- cycle = cycle_handlers.find do |klass|
72
+ cycle = Cycle.cycle_handlers.find do |klass|
73
73
  parser.parses?(klass.notation_id)
74
74
  end.new(notation, parser:)
75
75
  return cycle if parser.active?
@@ -84,7 +84,7 @@ module SOF
84
84
  # class_for_notation_id('L')
85
85
  #
86
86
  def class_for_notation_id(notation_id)
87
- cycle_handlers.find do |klass|
87
+ Cycle.cycle_handlers.find do |klass|
88
88
  klass.notation_id == notation_id
89
89
  end || raise(InvalidKind, "'#{notation_id}' is not a valid kind of #{name}")
90
90
  end
@@ -152,14 +152,14 @@ module SOF
152
152
  end
153
153
 
154
154
  def inherited(klass)
155
- cycle_handlers << klass
155
+ Cycle.cycle_handlers << klass
156
156
  end
157
157
 
158
158
  private
159
159
 
160
160
  def build_kind_legend
161
161
  legend = {}
162
- cycle_handlers.each do |handler|
162
+ Cycle.cycle_handlers.each do |handler|
163
163
  # Skip volume_only since it doesn't have a notation_id
164
164
  next if handler.instance_variable_get(:@volume_only)
165
165
 
@@ -231,7 +231,15 @@ module SOF
231
231
  end
232
232
 
233
233
  # Return the cycle representation as a notation string
234
- def notation = self.class.notation(to_h)
234
+ def notation
235
+ hash = to_h
236
+ [
237
+ "V#{volume}",
238
+ self.class.notation_id,
239
+ TimeSpan.notation(hash.slice(:period, :period_count)),
240
+ hash.fetch(:from, nil)
241
+ ].compact.join
242
+ end
235
243
 
236
244
  # Cycles are considered equal if their hash representations are equal
237
245
  def ==(other) = to_h == other.to_h
data/lib/sof/time_span.rb CHANGED
@@ -29,7 +29,7 @@ module SOF
29
29
 
30
30
  # Return a notation string from a hash
31
31
  def notation(hash)
32
- return unless hash.key?(:period)
32
+ return unless hash.key?(:period) && hash[:period].present?
33
33
 
34
34
  [
35
35
  hash.fetch(:period_count) { 1 },
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.8
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Gay
@@ -46,6 +46,7 @@ files:
46
46
  - ".claude/settings.local.json"
47
47
  - ".rspec"
48
48
  - ".simplecov"
49
+ - ".tool-versions"
49
50
  - CHANGELOG.md
50
51
  - CLAUDE.md
51
52
  - README.md
@@ -55,6 +56,8 @@ files:
55
56
  - checksums/sof-cycle-0.1.2.gem.sha512
56
57
  - checksums/sof-cycle-0.1.6.gem.sha512
57
58
  - checksums/sof-cycle-0.1.7.gem.sha512
59
+ - checksums/sof-cycle-0.1.8.gem.sha512
60
+ - checksums/sof-cycle-0.1.9.gem.sha512
58
61
  - lib/sof-cycle.rb
59
62
  - lib/sof/cycle.rb
60
63
  - lib/sof/cycle/version.rb