evt-schema 2.3.1.6 → 2.4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/schema/controls/schema.rb +1 -17
- data/lib/schema/schema.rb +5 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35387bf895aaceee0a8b592ba686dd1cdc24448c8bca10d7e7714f0ff55387b4
|
4
|
+
data.tar.gz: 8d60be6f2a80644f3fb6517d72c5d10842fc399386d509aeeb19cf051e99a61d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 712f0cc9e56c0d053226a21375336c16664b02ff8a77df029c32c01ad75c38bc02ce57bb3bcfef91ed93701a1c04e117ecb885d2da3e2e4b2da1ced3d5786cef
|
7
|
+
data.tar.gz: 5e403e19b077b933fc0d22783679ba3673e5afa8decc9e82dcb8d9f555222ab568241bfac3e5df6615e44d97ff1aedfb2975e0d5af6786536c76da04a4deb876
|
@@ -119,25 +119,9 @@ module Schema
|
|
119
119
|
end
|
120
120
|
|
121
121
|
class Example
|
122
|
-
include ::Schema
|
123
|
-
attribute :some_attribute, default: 'some default value'
|
124
|
-
attribute :some_other_attribute
|
125
|
-
end
|
126
|
-
|
127
|
-
class Primitive
|
128
|
-
include ::Schema
|
129
|
-
attribute :some_attribute, default: 11
|
130
|
-
attribute :some_other_attribute
|
131
|
-
end
|
132
|
-
|
133
|
-
class Proc
|
134
122
|
include ::Schema
|
135
123
|
attribute :some_attribute, default: proc { 'some default value' }
|
136
|
-
|
137
|
-
|
138
|
-
class ObjectReference
|
139
|
-
include ::Schema
|
140
|
-
attribute :some_attribute, default: []
|
124
|
+
attribute :some_other_attribute
|
141
125
|
end
|
142
126
|
end
|
143
127
|
|
data/lib/schema/schema.rb
CHANGED
@@ -62,11 +62,12 @@ module Schema
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
|
66
|
-
|
65
|
+
if default.nil?
|
66
|
+
initialize_value = nil
|
67
|
+
elsif default.respond_to?(:call)
|
67
68
|
initialize_value = default
|
68
|
-
|
69
|
-
|
69
|
+
else
|
70
|
+
raise Schema::Attribute::Error, "Default values must be callable, like procs, lambdas, or objects that respond to the call method (Attribute: #{attribute_name})"
|
70
71
|
end
|
71
72
|
|
72
73
|
::Attribute::Define.(self, attribute_name, :accessor, check: check, &initialize_value)
|
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.
|
4
|
+
version: 2.4.0.0
|
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: 2024-
|
11
|
+
date: 2024-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: evt-attribute
|
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
- !ruby/object:Gem::Version
|
137
137
|
version: '0'
|
138
138
|
requirements: []
|
139
|
-
rubygems_version: 3.
|
139
|
+
rubygems_version: 3.5.9
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: Primitives for schema and data structure
|