nxt_support 0.6.1 → 0.6.3
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 -0
- data/Gemfile.lock +6 -6
- data/lib/nxt_support/models/duration_attribute_accessor.rb +3 -1
- data/lib/nxt_support/util/crystalizer.rb +3 -8
- data/lib/nxt_support/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: df7d032c4cf505b1381021fb5118f9f2c71aee05eb1bdb4484915dc1aa9f78a8
|
|
4
|
+
data.tar.gz: 2cdf4c3050bcd760bc5f17bae3f3e12e550b0726eb20047e3a485d7a26853b3e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 52dad4f65484fc4b61cf6d0bdda7dab60d3b095a208f2c194d83f8254ef4bc9f1e49aee538bc2a3ab2fe1551c08cbd37e4dc6fa81a2f0a451d9a21475b818d7d
|
|
7
|
+
data.tar.gz: 5baa5b0e528521f30a6cd0b92674ed535a3f3b2a6b3d63ef96b448390de87cfc2d7170deba87a3bf9c6d3a3ac28ce923eaaf03cfc1e1a12630b90e6a998fd8b0
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
# v0.6.3 2026-08-11
|
|
2
|
+
- Fix `Crystalizer#call` to return the resolved value from a custom `on_ambiguity` handler instead of always returning `unique_values.first`
|
|
3
|
+
|
|
4
|
+
# v0.6.2 2026-04-30
|
|
5
|
+
- Fix `.validate_duration` and `.validates_durations` when used in combination with `duration_attribute_accessor`
|
|
6
|
+
|
|
1
7
|
# v0.6.1 2026-04-30
|
|
2
8
|
- Added `.validate_duration` and `.validates_durations` to `NxtSupport::DurationAttributeAccessor`
|
|
3
9
|
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
nxt_support (0.6.
|
|
4
|
+
nxt_support (0.6.3)
|
|
5
5
|
activerecord
|
|
6
6
|
activesupport
|
|
7
7
|
nxt_init
|
|
@@ -32,18 +32,18 @@ GEM
|
|
|
32
32
|
base64 (0.3.0)
|
|
33
33
|
bigdecimal (4.1.2)
|
|
34
34
|
coderay (1.1.3)
|
|
35
|
-
concurrent-ruby (1.3.
|
|
35
|
+
concurrent-ruby (1.3.8)
|
|
36
36
|
connection_pool (3.0.2)
|
|
37
37
|
diff-lcs (1.6.2)
|
|
38
38
|
drb (2.2.3)
|
|
39
|
-
i18n (1.
|
|
39
|
+
i18n (1.15.2)
|
|
40
40
|
concurrent-ruby (~> 1.0)
|
|
41
41
|
io-console (0.8.2)
|
|
42
|
-
json (2.
|
|
42
|
+
json (2.21.1)
|
|
43
43
|
logger (1.7.0)
|
|
44
44
|
method_source (1.1.0)
|
|
45
45
|
mini_portile2 (2.8.9)
|
|
46
|
-
minitest (6.0.
|
|
46
|
+
minitest (6.0.6)
|
|
47
47
|
drb (~> 2.0)
|
|
48
48
|
prism (~> 1.5)
|
|
49
49
|
nxt_init (0.1.5)
|
|
@@ -72,7 +72,7 @@ GEM
|
|
|
72
72
|
rspec-support (~> 3.13.0)
|
|
73
73
|
rspec-support (3.13.7)
|
|
74
74
|
securerandom (0.4.1)
|
|
75
|
-
sqlite3 (2.9.
|
|
75
|
+
sqlite3 (2.9.5)
|
|
76
76
|
mini_portile2 (~> 2.8.0)
|
|
77
77
|
timeout (0.6.1)
|
|
78
78
|
tzinfo (2.0.6)
|
|
@@ -22,7 +22,9 @@ module NxtSupport
|
|
|
22
22
|
|
|
23
23
|
def validates_durations(*attrs, **opts)
|
|
24
24
|
validates_each(*attrs, **opts) do |record, attr, value|
|
|
25
|
-
|
|
25
|
+
next if value.is_a?(ActiveSupport::Duration)
|
|
26
|
+
next if record.is_valid_iso8601_duration?(value)
|
|
27
|
+
record.errors.add attr, "is not a valid iso8601 duration."
|
|
26
28
|
end
|
|
27
29
|
end
|
|
28
30
|
|
|
@@ -7,8 +7,9 @@ module NxtSupport
|
|
|
7
7
|
attr_init :collection, on_ambiguity: -> { default_ambiguity_handler }, with: :itself
|
|
8
8
|
|
|
9
9
|
def call
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
return unique_values.first if unique_values.size == 1
|
|
11
|
+
|
|
12
|
+
on_ambiguity.arity == 1 ? on_ambiguity.call(resolved_collection) : on_ambiguity.call
|
|
12
13
|
end
|
|
13
14
|
|
|
14
15
|
private
|
|
@@ -24,11 +25,5 @@ module NxtSupport
|
|
|
24
25
|
def default_ambiguity_handler
|
|
25
26
|
->(collection) { raise Error, "Values in collection are not unanimous: #{collection}" }
|
|
26
27
|
end
|
|
27
|
-
|
|
28
|
-
def ensure_unanimity
|
|
29
|
-
return if unique_values.size == 1
|
|
30
|
-
|
|
31
|
-
on_ambiguity.arity == 1 ? on_ambiguity.call(resolved_collection) : on_ambiguity.call
|
|
32
|
-
end
|
|
33
28
|
end
|
|
34
29
|
end
|
data/lib/nxt_support/version.rb
CHANGED