datacaster 3.2.8 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e5f8dec00cd9987c6efe8bbf54939b6a4df8604cffb7bc2be43d3e97fc8c8b7
4
- data.tar.gz: a2bf2ab038537307304aade93ec9143fe489ece282ffb6d1bb92cdbe0d241de9
3
+ metadata.gz: 57a921f071865d8d6fae653de1e80edc19e1eaf5d2a37450ccd7b32a24f4386f
4
+ data.tar.gz: 5307a9a2f7619c331efd7620a2e1a2a7a3b11a82bec3e6ad760e8ec75a29ad84
5
5
  SHA512:
6
- metadata.gz: 4a99eaac0cfdb79b651ea7056dd77e279768e0ad0123107fb26f211cfe5d0bd605b0bfd19b649ac6041ac8a527c1314b5202ba790c2dfbea5bd85363a06756a6
7
- data.tar.gz: d351457a3693f7a919fe0252cfc664973231c91c7b50dd2404beb4bfefa4d515541147272bafbf9fd53b109e6565f04fd4202adaa9fa347587422f0342b08be4
6
+ metadata.gz: 5b7f3713ebd7ce4568ae79d612e0ee2a8277d0c6baeb398e24975ff95c1167d151649565378240445765ac3499ff5db0c65380d5f215556449505e6e9f2b88a1
7
+ data.tar.gz: 5dc58c8d0f853ce3d906e6606af932e7531012666f77a813bf38684463a4606e4bdae3d1f0c63ae1159a1573f30b274b3fffcf9224efa82c34705b73b1671261
@@ -6,7 +6,7 @@ jobs:
6
6
  runs-on: ubuntu-latest
7
7
  strategy:
8
8
  matrix:
9
- ruby-version: ['2.7', '3.0', '3.1']
9
+ ruby-version: ['3.1', '3.2', '3.3']
10
10
  steps:
11
11
  - uses: actions/checkout@v3
12
12
  - name: Set up Ruby
data/README.md CHANGED
@@ -847,7 +847,11 @@ I18n keys:
847
847
 
848
848
  #### `transform_to_value(value)`
849
849
 
850
- Always returns ValidResult. The value is transformed to provided argument (disregarding the original value). See also [`default`](#defaultdefault_value-on-nil).
850
+ Always returns ValidResult. The value is transformed to provided argument (disregarding the original value).
851
+
852
+ Returned value is deeply freezed with [`Ractor::make_shareable`](https://docs.ruby-lang.org/en/master/Ractor.html#method-c-make_shareable) to prevent application bugs due to modification of unintentionally shared value. If that effect is undesired, use [`transform { value }`](#transform--value--) instead.
853
+
854
+ See also [`default`](#defaultdefault_value-on-nil).
851
855
 
852
856
  ### "Web-form" types
853
857
 
data/datacaster.gemspec CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
 
9
9
  spec.summary = %q{Run-time type checker and transformer for Ruby}
10
10
  spec.license = 'MIT'
11
- spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0')
11
+ spec.required_ruby_version = Gem::Requirement.new('>= 3.1')
12
12
 
13
13
  spec.metadata['source_code_uri'] = 'https://github.com/EugZol/datacaster'
14
14
  spec.homepage = 'https://github.com/EugZol/datacaster'
@@ -19,5 +19,9 @@ module Datacaster
19
19
  def present?
20
20
  false
21
21
  end
22
+
23
+ def ==(other)
24
+ other.is_a?(self.class)
25
+ end
22
26
  end
23
27
  end
@@ -276,7 +276,7 @@ module Datacaster
276
276
  end
277
277
 
278
278
  def transform_to_value(value)
279
- transform { value }
279
+ transform { Datacaster::Utils.deep_freeze(value) }
280
280
  end
281
281
 
282
282
  def with(keys, caster)
@@ -2,6 +2,10 @@ module Datacaster
2
2
  module Utils
3
3
  extend self
4
4
 
5
+ def deep_freeze(value, copy: true)
6
+ Ractor.make_shareable(value, copy:)
7
+ end
8
+
5
9
  def merge_errors(left, right)
6
10
  add_error_to_base = ->(hash, error) {
7
11
  hash[:base] ||= []
@@ -1,3 +1,3 @@
1
1
  module Datacaster
2
- VERSION = "3.2.8"
2
+ VERSION = "3.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datacaster
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.8
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eugene Zolotarev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-07 00:00:00.000000000 Z
11
+ date: 2024-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -186,14 +186,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
186
186
  requirements:
187
187
  - - ">="
188
188
  - !ruby/object:Gem::Version
189
- version: 2.7.0
189
+ version: '3.1'
190
190
  required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - ">="
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
195
  requirements: []
196
- rubygems_version: 3.4.6
196
+ rubygems_version: 3.5.14
197
197
  signing_key:
198
198
  specification_version: 4
199
199
  summary: Run-time type checker and transformer for Ruby