guide-rail 0.2.4 → 0.2.5

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: 98df92fa1d9c4488f24fe857a93455e31b8a010dc024a190afb250adbea3ff7f
4
- data.tar.gz: 461b2d1f51cdff8a4b894281466571c724794ab3945889feb9757856e3442d09
3
+ metadata.gz: 68342bb92a1b43e2cfbbb015595332832d105e98fe86a05b57ffd084339d0940
4
+ data.tar.gz: 37736378ff24a0bef3dfe79ffb0c63a7d7ed86272da7306a60eefc76c78db6a7
5
5
  SHA512:
6
- metadata.gz: ece2d85928f2ca3637f3bffcfef6a05ed0d4e613b3ac0298bbf63c3e9b81348d43a906f9ef8dc5ac9690d1d2128d7d35106a8b17403e89c7cd04e501e9d1beae
7
- data.tar.gz: b8d26611d6824c1d6e53084a0f311e8c58c422cd52653b514c75a5aaee6f1032d96c64f6c7bbb31938bf883bde031c542e2db1014980e51c5943d7beb363d17d
6
+ metadata.gz: 35fe93962c60b50699ef50678d0b156ade74e7a3fbeb2aac7ef760828790a7ab1e509409f63a9ab9ce7da0707ac9d8772f5a6010f9530d45aadd7431fd763aac
7
+ data.tar.gz: 7c3d653488dd0ed9f28ad689a71d65c55af3b9d902b0d5c0e11c2c69416516b280ff3ead4360146f49e85adc58cb4e35215a822bfd90013fa7a5cff891832e34
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.2.5] - 2026-11-22
2
+
3
+ - Fix `renderable` with `computed` overwriting a nested schema attr. When the computed returns `nil`, the default of the schema shape ( e.g. `{lat: "", lon: ""}` ) is set instead of `""`
4
+
1
5
  ## [0.2.4] - 2026-11-22
2
6
 
3
7
  - Fix syntax and arguments of `sig/guide-rail.rbs`. It could not be parsed by rbs since 0.1.0
data/README.md CHANGED
@@ -18,6 +18,8 @@ It acts as a "guide rail," ensuring that data flowing into your application (e.g
18
18
 
19
19
  ## Installation
20
20
 
21
+ Requires Ruby 3.2 or later. CI tests with Ruby 3.2, 3.3, 3.4 and 4.0.
22
+
21
23
  Add this line to your application's Gemfile:
22
24
 
23
25
  ```ruby
@@ -76,7 +76,7 @@ class GuideRail::Factory
76
76
  if result.success?
77
77
  values = schema_values(result)
78
78
  values.merge!(compute(values))
79
- values = to_renderable(values, renderable_default.merge(computed_shallow_renderable_default)) if @_renderable
79
+ values = to_renderable(values, computed_shallow_renderable_default.merge(renderable_default)) if @_renderable
80
80
 
81
81
  new_value = Object.const_get(@_class_name).new(*values.values_at(*all_member_names).map(&:freeze))
82
82
 
@@ -130,6 +130,9 @@ class GuideRail::Factory
130
130
  @_computeds.transform_values { |block| block.call(acc).freeze }
131
131
  end
132
132
 
133
+ #
134
+ # Computed attrs have no shape, so the default is "". For a computed attr
135
+ # overwriting a schema attr, the default of the schema shape takes precedence.
133
136
  #
134
137
  # @return [Hash]
135
138
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GuideRail
4
- VERSION = "0.2.4"
4
+ VERSION = "0.2.5"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guide-rail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - wtnabe