shale-builder 0.6.5 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c1880d034ce6c63d442b30d8e32e6f4bd45fd7013e4d97e8c2659c3a82f1bc69
4
- data.tar.gz: 41016cd336e6ff741b569e08a2068da6447cd2c2a93aadb8b116c589d85b9164
3
+ metadata.gz: a0bb7fdc1a286efcf893e13eb582ce75308e644ba0b97d61416e8960179b1abb
4
+ data.tar.gz: 1b1c5e02a9deb9cd87ad860ec3121933a4afc17606e07541bff808fa9af4747a
5
5
  SHA512:
6
- metadata.gz: '088bc9b1de2492906791470ca83abd6ba56b0f2bbbeba87d816acb03b70a400b2ae56cb72b2a8bbb7f3dd42897856cf714a46ac835674a4c077cbb0ded4d77ef'
7
- data.tar.gz: 0c61bc12a78e9306b8cc815020d11049272a49dd17b0b8900a059f5daada80a79164b3f08be18950025b95c59f135fc769138ac753ef87fc0abd63d300ba01e3
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shale-builder (0.6.5)
4
+ shale-builder (0.7.0)
5
5
  booleans (>= 0.1)
6
6
  shale (< 2.0)
7
7
  sorbet-runtime (> 0.5)
@@ -41,7 +41,7 @@ module Shale
41
41
  #: (Class subclass) -> void
42
42
  def inherited(subclass)
43
43
  super
44
- Builder.prepare_mod(subclass)
44
+ AssignedAttributes.prepare_mod(subclass)
45
45
  end
46
46
 
47
47
  # Contains overridden getter methods for attributes
@@ -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}.#{err.attribute}")
53
+ errlist.import(err, attribute: "#{name}#{separator}#{err.attribute}")
44
54
  end
45
55
  end
46
56
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Shale
4
4
  module Builder
5
- VERSION = '0.6.5'
5
+ VERSION = '0.7.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shale-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mateusz Drewniak