evt-schema 2.3.0.2 → 2.3.1.3
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/data_structure.rb +15 -2
- data/lib/schema/schema.rb +16 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b428a68d93f45e5bd364e815d925c82645e38025fc00c9204ae9b3e0f4f09b1
|
4
|
+
data.tar.gz: 39063eab4c9e83332a4963b1cb5a640279b245f9355d39783b368ba94bdf469b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e2d106b624da65230439ba3d62b8c8ba162b60ed60d03506753c4fe6da9c176a8ede38fa587bdeeeca858354d3fd15f539c5c476a26a2d4d70160f2eab7b43d
|
7
|
+
data.tar.gz: fac1fd85a1cfa3bdb9f4bb2577e5f3548fe254b61c099ee7adf55ac04e4ce39a0fa99ba46726949d29e5f5164cc8b280e16b3d3ae0bbe61fc92e8841e6487fdc
|
@@ -27,6 +27,7 @@ module Schema
|
|
27
27
|
|
28
28
|
class Example
|
29
29
|
include ::Schema::DataStructure
|
30
|
+
|
30
31
|
attribute :some_attribute
|
31
32
|
end
|
32
33
|
|
@@ -66,7 +67,11 @@ module Schema
|
|
66
67
|
example
|
67
68
|
end
|
68
69
|
|
69
|
-
class Example
|
70
|
+
class Example
|
71
|
+
include ::Schema::DataStructure
|
72
|
+
|
73
|
+
attribute :some_attribute
|
74
|
+
|
70
75
|
def transform_read(data)
|
71
76
|
data[:some_attribute] = 'some read value'
|
72
77
|
end
|
@@ -91,7 +96,11 @@ module Schema
|
|
91
96
|
example
|
92
97
|
end
|
93
98
|
|
94
|
-
class Example
|
99
|
+
class Example
|
100
|
+
include ::Schema::DataStructure
|
101
|
+
|
102
|
+
attribute :some_attribute
|
103
|
+
|
95
104
|
def transform_in(data)
|
96
105
|
data[:some_attribute] = 'some read value'
|
97
106
|
end
|
@@ -107,6 +116,10 @@ module Schema
|
|
107
116
|
Error = Class.new(RuntimeError)
|
108
117
|
|
109
118
|
class Example < DataStructure::Example
|
119
|
+
include ::Schema::DataStructure
|
120
|
+
|
121
|
+
attribute :some_attribute
|
122
|
+
|
110
123
|
def transform_read(data)
|
111
124
|
raise Error
|
112
125
|
end
|
data/lib/schema/schema.rb
CHANGED
@@ -161,14 +161,23 @@ module Schema
|
|
161
161
|
end
|
162
162
|
end
|
163
163
|
|
164
|
+
def raw_attributes
|
165
|
+
all_attribute_names = self.class.all_attribute_names
|
166
|
+
get_attributes(all_attribute_names)
|
167
|
+
end
|
168
|
+
|
169
|
+
def get_attributes(attribute_names)
|
170
|
+
attribute_names.each_with_object({}) do |attribute_name, attributes|
|
171
|
+
attributes[attribute_name] = public_send(attribute_name)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
164
175
|
def attributes(include_transient: nil)
|
165
176
|
include_transient ||= false
|
166
177
|
|
167
178
|
attribute_names = self.class.attribute_names(include_transient: include_transient)
|
168
179
|
|
169
|
-
data = attribute_names
|
170
|
-
attributes[attribute_name] = public_send(attribute_name)
|
171
|
-
end
|
180
|
+
data = get_attributes(attribute_names)
|
172
181
|
|
173
182
|
transform_write(data)
|
174
183
|
|
@@ -197,4 +206,8 @@ module Schema
|
|
197
206
|
!different
|
198
207
|
end
|
199
208
|
alias :eql? :==
|
209
|
+
|
210
|
+
def hash
|
211
|
+
[self.class, raw_attributes].hash
|
212
|
+
end
|
200
213
|
end
|
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.
|
4
|
+
version: 2.3.1.3
|
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: 2022-
|
11
|
+
date: 2022-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: evt-attribute
|