core-boundary 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/core/boundary/reference.rb +23 -13
- data/lib/core/boundary/version.rb +1 -1
- data/lib/is/boundary.rb +4 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a3c60c0403b1eae350795cf62fb64a08a13fe081afdd99113d62156087a296b
|
4
|
+
data.tar.gz: 9bd8395ab67510bd42ba0bb6f82352375e02395c273a970477bb12a5bd30e973
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e8ada0220bc91451e05aaa771ef405799d568d47d218afdebc099df2a482ccc67d1a29ccc6e1cd2f619d9f24bda09823af0ebe539f809a08d4cb958e00c8660
|
7
|
+
data.tar.gz: 429f0f93a5eebd24d9c09ebd68f788d4bdfdfcae1b8b33ae7ee63b2150f5beef8fbdcbcdd41c528583f3ddc5a12e76c7cab5cec6b34e39ff33edc1551615b88f
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## [v0.0.1](https://github.com/bryanp/corerb/releases/tag/2023-12-20)
|
2
|
+
|
3
|
+
*released on 2023-12-20*
|
4
|
+
|
5
|
+
* `fix` [#139](https://github.com/bryanp/corerb/pull/139) Copy default values when they are resolved ([bryanp](https://github.com/bryanp))
|
6
|
+
* `fix` [#138](https://github.com/bryanp/corerb/pull/138) Fix a couple issues verifying optional undefined values ([bryanp](https://github.com/bryanp))
|
7
|
+
* `fix` [#137](https://github.com/bryanp/corerb/pull/137) Fix an issue using default verifiers with subclasses ([bryanp](https://github.com/bryanp))
|
8
|
+
|
1
9
|
## [v0.0.0](https://github.com/bryanp/corerb/releases/tag/2023-12-19)
|
2
10
|
|
3
11
|
*released on 2023-12-19*
|
@@ -33,6 +33,8 @@ module Core
|
|
33
33
|
# [public]
|
34
34
|
#
|
35
35
|
def resolve(object, result:)
|
36
|
+
value_undefined = false
|
37
|
+
|
36
38
|
catch :__core_boundary_value_error__ do
|
37
39
|
value = case object
|
38
40
|
when Hash
|
@@ -42,7 +44,9 @@ module Core
|
|
42
44
|
result.errors.add(@reference, @message)
|
43
45
|
throw :__core_boundary_value_error__
|
44
46
|
elsif @default != UNDEFINED
|
45
|
-
@default
|
47
|
+
@default.clone
|
48
|
+
else
|
49
|
+
value_undefined = true
|
46
50
|
end
|
47
51
|
}
|
48
52
|
}
|
@@ -53,25 +57,31 @@ module Core
|
|
53
57
|
result.errors.add(@reference, @message)
|
54
58
|
throw :__core_boundary_value_error__
|
55
59
|
elsif @default != UNDEFINED
|
56
|
-
@default
|
60
|
+
@default.clone
|
61
|
+
else
|
62
|
+
value_undefined = true
|
57
63
|
end
|
58
64
|
end
|
59
65
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
66
|
+
unless value_undefined
|
67
|
+
begin
|
68
|
+
value = @type.build(@normalizer.call(value))
|
69
|
+
rescue Core::Type::CheckFailed
|
70
|
+
result.errors.add(@reference, :type_failure)
|
71
|
+
throw :__core_boundary_value_error__
|
72
|
+
end
|
65
73
|
end
|
66
74
|
|
67
75
|
@validator.call(value, result: result, reference: @reference)
|
68
76
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
77
|
+
unless value_undefined
|
78
|
+
result[@reference] = if @verifier.empty?
|
79
|
+
value
|
80
|
+
else
|
81
|
+
nested = @verifier.verify(value)
|
82
|
+
result.errors.merge!(*@reference, nested.errors)
|
83
|
+
nested.values
|
84
|
+
end
|
75
85
|
end
|
76
86
|
end
|
77
87
|
end
|
data/lib/is/boundary.rb
CHANGED
@@ -33,7 +33,7 @@ module Is
|
|
33
33
|
end
|
34
34
|
|
35
35
|
if default == true
|
36
|
-
@__default_boundary__verifier__ =
|
36
|
+
@__default_boundary__verifier__ = method
|
37
37
|
end
|
38
38
|
|
39
39
|
if block
|
@@ -48,6 +48,8 @@ module Is
|
|
48
48
|
unless ancestors.include?(__boundaries_module__)
|
49
49
|
prepend(__boundaries_module__)
|
50
50
|
end
|
51
|
+
|
52
|
+
verifier
|
51
53
|
end
|
52
54
|
end
|
53
55
|
|
@@ -56,7 +58,7 @@ module Is
|
|
56
58
|
extends :definition, prepend: true do
|
57
59
|
def method_missing(name, ...)
|
58
60
|
if delegate_to_default_boundary?(name)
|
59
|
-
__default_boundary__verifier__.__send__(name, ...)
|
61
|
+
__boundary_verifiers__[__default_boundary__verifier__].__send__(name, ...)
|
60
62
|
else
|
61
63
|
super
|
62
64
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: core-boundary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Powell
|
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
|
-
rubygems_version: 3.
|
124
|
+
rubygems_version: 3.5.1
|
125
125
|
signing_key:
|
126
126
|
specification_version: 4
|
127
127
|
summary: Define boundaries for verification, validation, and normalization.
|