evt-schema 2.3.0.0 → 2.3.0.1

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: 6298a47ba57d055166492488cc80134821dc6c8854623a1828ab126beeb2f05f
4
- data.tar.gz: c8bbcbc6d8ada0ce2169b1aa35cba6f117bd03928511d320fa4040820a65cd0d
3
+ metadata.gz: f332c2468a6e32cfd2cfdcdea372f004c620ca7679ad146ed8c63f66d851dbc0
4
+ data.tar.gz: 3bd8893da9e6c466bba9175747402531f56df1f9cf32644297231bd1de0c502e
5
5
  SHA512:
6
- metadata.gz: 1c0b44340c1d7dacb2eaff58411ddbf8e0decf77fc132590c290a7aed8314b719446076eb88e25ecd7a795ae1298e90416bd58f476a8ea5bc6a1ef89648ce5d8
7
- data.tar.gz: bd84b8ee4f51e07275fc1b21bc44edc275cc33985bc0b20148a825fcd796bdd902e9fd4f17228e18493e08248c92b1c79c3597da9e6214ddeb3807a5f0fa04d6
6
+ metadata.gz: c1a631fe2dbf4dba122f20a1fe81d8afe5b95e93297f4e0009e3e9afb907544f1f276b40e96adc5e364d387a527c1a0258251ee33abeb41c4d10463439405351
7
+ data.tar.gz: 29626ec60e70ac92def2e729a7097e2207ebdd96ca5c717129b78e64ab2db6e2c8fb64600b3a802ca46d074108d8ea30cbf818226e9972aaccf1635eae9513db
@@ -102,6 +102,16 @@ module Schema
102
102
  end
103
103
  end
104
104
  end
105
+
106
+ module TransformReadFail
107
+ Error = Class.new(RuntimeError)
108
+
109
+ class Example < DataStructure::Example
110
+ def transform_read(data)
111
+ raise Error
112
+ end
113
+ end
114
+ end
105
115
  end
106
116
  end
107
117
  end
@@ -24,8 +24,11 @@ module Schema
24
24
  strict ||= false
25
25
 
26
26
  new.tap do |instance|
27
- instance.transform_read(data)
28
- set_attributes(instance, data, strict)
27
+ if not data.empty?
28
+ instance.transform_read(data)
29
+ set_attributes(instance, data, strict)
30
+ end
31
+
29
32
  instance.configure_dependencies
30
33
  end
31
34
  end
data/lib/schema/fixtures CHANGED
@@ -1 +1 @@
1
- lib/schema/Users/sbellware/projects/eventide/schema-fixtures/lib/schema/fixtures
1
+ /Users/sbellware/projects/eventide/schema-fixtures/lib/schema/fixtures
@@ -1 +1 @@
1
- lib/schema/Users/sbellware/projects/eventide/schema-fixtures/lib/schema/fixtures.rb
1
+ /Users/sbellware/projects/eventide/schema-fixtures/lib/schema/fixtures.rb
@@ -0,0 +1,50 @@
1
+ Foo.build
2
+
3
+ -> transform_read({})
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+ class Thing
14
+ attribute :some_attribute, String
15
+ attribute :some_object, SomeClass
16
+
17
+ def self.transform_read(data)
18
+ some_object_data = data[:some_object] # => nil or some hash
19
+
20
+ if not some_object_data.nil?
21
+ foo_data = some_object_data[:foo] # => Error
22
+ end
23
+
24
+ some_object = SomeClass.build(some_object_data)
25
+
26
+ data[:some_object] = some_object
27
+ end
28
+ end
29
+
30
+ class SomeClass
31
+ attribute :foo
32
+ end
33
+
34
+
35
+ data = {}
36
+ thing = Thing.build(data)
37
+
38
+ build(data) -> transform_read(data) # Rem: data is empty
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+ thing = data[:some_atttribute]
47
+ # => nil
48
+
49
+ thing.other_thing
50
+ # => nil reference error
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evt-schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0.0
4
+ version: 2.3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Eventide Project
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-21 00:00:00.000000000 Z
11
+ date: 2022-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: evt-attribute
@@ -117,6 +117,7 @@ files:
117
117
  - lib/schema/schema/compare.rb
118
118
  - lib/schema/schema/compare/comparison.rb
119
119
  - lib/schema/schema/compare/comparison/entry.rb
120
+ - lib/schema/scratch.rb
120
121
  - lib/schema/validation/error.rb
121
122
  - lib/schema/validation/nil_attributes.rb
122
123
  homepage: https://github.com/eventide-project/schema
@@ -138,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
139
  - !ruby/object:Gem::Version
139
140
  version: '0'
140
141
  requirements: []
141
- rubygems_version: 3.1.2
142
+ rubygems_version: 3.3.3
142
143
  signing_key:
143
144
  specification_version: 4
144
145
  summary: Primitives for schema and data structure