sof-cycle 0.1.11 → 0.1.12
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 -2
- data/checksums/sof-cycle-0.1.11.gem.sha512 +1 -0
- data/lib/sof/cycle/version.rb +1 -1
- data/lib/sof/cycles/end_of.rb +16 -7
- data/lib/sof/cycles/volume_only.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24c5b52ab1efb27e840af6448d16f2d74074310909a00d6d8a9bd10d42466b83
|
4
|
+
data.tar.gz: a7507d727a8c7d87b34a6cabeccd49abaabb9ae29374bed6c9eff70a800d9c9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: deb2c0b296fef6fdc65fb0db0e7d92934de2c8a402f96757ac357446e87c2dc4d5cd880e6a8a210aed4bc794ff1977bba1397fb2de96aadd909879566851e783
|
7
|
+
data.tar.gz: e238e4937718f34f644acf024ea4aae39742eee04a9b6d0b75a10df2306219ab8c3ac13abf6d7760e401d9554882f467518348ba0744e1eb51cf0fd2741452b9
|
data/CHANGELOG.md
CHANGED
@@ -5,10 +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.12] - 2025-09-05
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- Missing code coverage and updated EndOf to properly handle dormant cycles.
|
13
|
+
|
8
14
|
## [0.1.11] - 2025-09-05
|
9
15
|
|
10
16
|
### Changed
|
11
17
|
|
12
18
|
- Use `time_span.notation` instead of `TimeSpan.notation` in `Cycle#notation`.
|
13
|
-
|
14
|
-
## [0.1.10] - 2025-09-04
|
@@ -0,0 +1 @@
|
|
1
|
+
3ce0dfe7d95a5cde507d7563ca9aa834457913dff9861d36547cff571fa9371be9fdeb60ec6892edb23b14945ab7a25f569d86cb023b67adfd3028a4570ac381
|
data/lib/sof/cycle/version.rb
CHANGED
data/lib/sof/cycles/end_of.rb
CHANGED
@@ -27,7 +27,7 @@ module SOF
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def to_s
|
30
|
-
return dormant_to_s if dormant?
|
30
|
+
return dormant_to_s if parser.dormant? || from_date.nil?
|
31
31
|
|
32
32
|
"#{volume}x by #{final_date.to_fs(:american)}"
|
33
33
|
end
|
@@ -45,12 +45,18 @@ module SOF
|
|
45
45
|
# Cycle.for("V1E18MF2020-01-09")
|
46
46
|
# .expiration_of(anchor: "2020-06-04".to_date)
|
47
47
|
# # => #<Date: 2021-06-30>
|
48
|
-
def expiration_of(_ = nil, anchor: nil)
|
48
|
+
def expiration_of(_ = nil, anchor: nil)
|
49
|
+
return nil if parser.dormant? || from_date.nil?
|
50
|
+
final_date
|
51
|
+
end
|
49
52
|
|
50
53
|
# Is the supplied anchor date prior to the final date?
|
51
54
|
#
|
52
55
|
# @return [Boolean] true if the cycle is satisfied, false otherwise
|
53
|
-
def satisfied_by?(_ = nil, anchor: Date.current)
|
56
|
+
def satisfied_by?(_ = nil, anchor: Date.current)
|
57
|
+
return false if parser.dormant? || from_date.nil?
|
58
|
+
anchor <= final_date
|
59
|
+
end
|
54
60
|
|
55
61
|
# Calculates the final date of the cycle
|
56
62
|
#
|
@@ -61,11 +67,14 @@ module SOF
|
|
61
67
|
# @example
|
62
68
|
# Cycle.for("V1E18MF2020-01-09").final_date
|
63
69
|
# # => #<Date: 2021-06-30>
|
64
|
-
def final_date(_ = nil)
|
65
|
-
.
|
66
|
-
|
70
|
+
def final_date(_ = nil)
|
71
|
+
return nil if parser.dormant? || from_date.nil?
|
72
|
+
time_span
|
73
|
+
.end_date(start_date - 1.send(period))
|
74
|
+
.end_of_month
|
75
|
+
end
|
67
76
|
|
68
|
-
def start_date(_ = nil) = from_date
|
77
|
+
def start_date(_ = nil) = from_date&.to_date
|
69
78
|
|
70
79
|
private
|
71
80
|
|
@@ -12,7 +12,7 @@ module SOF
|
|
12
12
|
def handles?(sym) = sym.nil? || sym.to_s == "volume_only"
|
13
13
|
|
14
14
|
def validate_period(period)
|
15
|
-
raise InvalidPeriod, <<~ERR.squish unless period.nil?
|
15
|
+
raise Cycle::InvalidPeriod, <<~ERR.squish unless period.nil?
|
16
16
|
Invalid period value of '#{period}' provided. Valid periods are:
|
17
17
|
#{valid_periods.join(", ")}
|
18
18
|
ERR
|
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.
|
4
|
+
version: 0.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Gay
|
@@ -54,6 +54,7 @@ files:
|
|
54
54
|
- checksums/sof-cycle-0.1.0.gem.sha512
|
55
55
|
- checksums/sof-cycle-0.1.1.gem.sha512
|
56
56
|
- checksums/sof-cycle-0.1.10.gem.sha512
|
57
|
+
- checksums/sof-cycle-0.1.11.gem.sha512
|
57
58
|
- checksums/sof-cycle-0.1.2.gem.sha512
|
58
59
|
- checksums/sof-cycle-0.1.6.gem.sha512
|
59
60
|
- checksums/sof-cycle-0.1.7.gem.sha512
|