shale-builder 0.6.6 → 0.7.0
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 +7 -0
- data/Gemfile.lock +1 -1
- data/lib/shale/builder/nested_validations.rb +11 -1
- data/lib/shale/builder/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: a0bb7fdc1a286efcf893e13eb582ce75308e644ba0b97d61416e8960179b1abb
|
|
4
|
+
data.tar.gz: 1b1c5e02a9deb9cd87ad860ec3121933a4afc17606e07541bff808fa9af4747a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: abd61d99919161f2fef011a0db94390f8a0239f33b7e175569d773ad2b4ba519130d1ff97b3a5f83bb3ad2e705a6d64ef8dfa9ca15ca9c871b9ad26aff25274d
|
|
7
|
+
data.tar.gz: 4589178be4684e967fd37ecf4e2ad1c7a22198fa387ee787fd968fa31af61c8874a7040d15fd64c3444839575684abdfaf03e41dcc530e15b47123f3369a39d6
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@ 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.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.7.0] - 2025-10-17
|
|
9
|
+
|
|
10
|
+
[Diff](https://github.com/Verseth/ruby-shale-builder/compare/v0.6.4...v0.7.0)
|
|
11
|
+
|
|
12
|
+
### Changes
|
|
13
|
+
- Add `Shale::Builder::NestedValidations::nested_attr_name_separator` that lets users customise the nested attribute name separator in validation errors
|
|
14
|
+
|
|
8
15
|
## [0.6.4] - 2025-10-16
|
|
9
16
|
|
|
10
17
|
[Diff](https://github.com/Verseth/ruby-shale-builder/compare/v0.6.3...v0.6.4)
|
data/Gemfile.lock
CHANGED
|
@@ -18,6 +18,14 @@ module Shale
|
|
|
18
18
|
module ClassMethods
|
|
19
19
|
extend T::Sig
|
|
20
20
|
|
|
21
|
+
#: String
|
|
22
|
+
attr_writer :nested_attr_name_separator
|
|
23
|
+
|
|
24
|
+
#: -> String
|
|
25
|
+
def nested_attr_name_separator
|
|
26
|
+
@nested_attr_name_separator ||= '.'
|
|
27
|
+
end
|
|
28
|
+
|
|
21
29
|
sig { returns(T::Hash[Symbol, Shale::Attribute]) }
|
|
22
30
|
def validatable_attributes
|
|
23
31
|
@validatable_attributes ||= attributes.select do |_, val|
|
|
@@ -31,6 +39,8 @@ module Shale
|
|
|
31
39
|
def valid?
|
|
32
40
|
result = super
|
|
33
41
|
errlist = errors
|
|
42
|
+
klass = self.class #: as untyped
|
|
43
|
+
separator = klass.nested_attr_name_separator
|
|
34
44
|
|
|
35
45
|
attrs = T.unsafe(self).class.validatable_attributes
|
|
36
46
|
attrs.each_key do |name|
|
|
@@ -40,7 +50,7 @@ module Shale
|
|
|
40
50
|
|
|
41
51
|
result = false
|
|
42
52
|
val.errors.each do |err|
|
|
43
|
-
errlist.import(err, attribute: "#{name}
|
|
53
|
+
errlist.import(err, attribute: "#{name}#{separator}#{err.attribute}")
|
|
44
54
|
end
|
|
45
55
|
end
|
|
46
56
|
|