evt-schema 2.2.4.2 → 2.2.6.1
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 +4 -4
- data/lib/schema/controls/data_structure.rb +18 -0
- data/lib/schema/controls/schema.rb +14 -5
- data/lib/schema/data_structure.rb +21 -1
- data/lib/schema/fixtures +1 -0
- data/lib/schema/fixtures.rb +1 -0
- data/lib/schema/schema.rb +6 -2
- data/lib/schema/schema/compare/comparison.rb +2 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9299b9d03473151d2ac17454be8a3fa58a77ff2db066742d5930960b041340a1
|
4
|
+
data.tar.gz: b414f51b769f2efad19b78af1b4c3e8ac31ae855516f303de78c2d464e60a666
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e1dd9b3f459e6134c596674b634db32020767278ed6fd59283cc51c920bfc228d1b0e657e17450b06e552b568d2407218d22b3537b43fba57b4a2759da53a80
|
7
|
+
data.tar.gz: be27088bda8b35cc4ac9b507d89513fb6705b430040145d4e062492253b2884b52c60f2352705744088a21a9dc316243153c09fa2748ef25bc217071cbe3e5f8
|
@@ -83,6 +83,24 @@ module Schema
|
|
83
83
|
}
|
84
84
|
end
|
85
85
|
end
|
86
|
+
|
87
|
+
module InAndOutAliases
|
88
|
+
def self.example
|
89
|
+
example = Example.new
|
90
|
+
example.some_attribute = DataStructure.some_attribute
|
91
|
+
example
|
92
|
+
end
|
93
|
+
|
94
|
+
class Example < DataStructure::Example
|
95
|
+
def transform_in(data)
|
96
|
+
data[:some_attribute] = 'some read value'
|
97
|
+
end
|
98
|
+
|
99
|
+
def transform_out(data)
|
100
|
+
data[:some_attribute] = 'some written value'
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
86
104
|
end
|
87
105
|
end
|
88
106
|
end
|
@@ -124,11 +124,20 @@ module Schema
|
|
124
124
|
attribute :some_other_attribute
|
125
125
|
end
|
126
126
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
127
|
+
class Primitive
|
128
|
+
include ::Schema
|
129
|
+
attribute :some_attribute, default: 11
|
130
|
+
attribute :some_other_attribute
|
131
|
+
end
|
132
|
+
|
133
|
+
class Proc
|
134
|
+
include ::Schema
|
135
|
+
attribute :some_attribute, default: proc { 'some default value' }
|
136
|
+
end
|
137
|
+
|
138
|
+
class ObjectReference
|
139
|
+
include ::Schema
|
140
|
+
attribute :some_attribute, default: []
|
132
141
|
end
|
133
142
|
end
|
134
143
|
|
@@ -10,7 +10,11 @@ module Schema
|
|
10
10
|
virtual :configure_dependencies do
|
11
11
|
configure
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
|
+
virtual :transform_read do |data|
|
15
|
+
transform_in(data)
|
16
|
+
end
|
17
|
+
virtual :transform_in
|
14
18
|
end
|
15
19
|
end
|
16
20
|
|
@@ -34,5 +38,21 @@ module Schema
|
|
34
38
|
end
|
35
39
|
end
|
36
40
|
end
|
41
|
+
|
42
|
+
def deep_copy
|
43
|
+
data = to_h
|
44
|
+
self.class.build(data)
|
45
|
+
end
|
46
|
+
alias :dup :deep_copy
|
47
|
+
|
48
|
+
def clone
|
49
|
+
duplicate = deep_copy
|
50
|
+
|
51
|
+
if frozen?
|
52
|
+
duplicate.freeze
|
53
|
+
end
|
54
|
+
|
55
|
+
duplicate
|
56
|
+
end
|
37
57
|
end
|
38
58
|
end
|
data/lib/schema/fixtures
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
lib/schema/Users/sbellware/projects/eventide/schema-fixtures/lib/schema/fixtures
|
@@ -0,0 +1 @@
|
|
1
|
+
lib/schema/Users/sbellware/projects/eventide/schema-fixtures/lib/schema/fixtures.rb
|
data/lib/schema/schema.rb
CHANGED
@@ -8,7 +8,11 @@ module Schema
|
|
8
8
|
extend Attributes
|
9
9
|
|
10
10
|
include Virtual
|
11
|
-
|
11
|
+
|
12
|
+
virtual :transform_write do |data|
|
13
|
+
transform_out(data)
|
14
|
+
end
|
15
|
+
virtual :transform_out
|
12
16
|
|
13
17
|
const_set(:Boolean, Boolean)
|
14
18
|
end
|
@@ -58,7 +62,7 @@ module Schema
|
|
58
62
|
if default.is_a? Proc
|
59
63
|
initialize_value = default
|
60
64
|
elsif !default.nil?
|
61
|
-
initialize_value = proc { default }
|
65
|
+
initialize_value = proc { default.clone }
|
62
66
|
end
|
63
67
|
|
64
68
|
::Attribute::Define.(self, attribute_name, :accessor, check: check, &initialize_value)
|
@@ -28,11 +28,11 @@ module Schema
|
|
28
28
|
|
29
29
|
def self.assure_schemas(control, compare)
|
30
30
|
if not control.is_a?(Schema)
|
31
|
-
raise Error,
|
31
|
+
raise Error, "Control object is not an implementation of Schema (Control Class: #{control.class.name})"
|
32
32
|
end
|
33
33
|
|
34
34
|
if not compare.is_a?(Schema)
|
35
|
-
raise Error,
|
35
|
+
raise Error, "Compare object is not an implementation of Schema (Compare Class: #{compare.class.name})"
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
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.2.
|
4
|
+
version: 2.2.6.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-07-
|
11
|
+
date: 2020-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: evt-attribute
|
@@ -110,6 +110,8 @@ files:
|
|
110
110
|
- lib/schema/controls/schema.rb
|
111
111
|
- lib/schema/controls/schema/different.rb
|
112
112
|
- lib/schema/data_structure.rb
|
113
|
+
- lib/schema/fixtures
|
114
|
+
- lib/schema/fixtures.rb
|
113
115
|
- lib/schema/schema.rb
|
114
116
|
- lib/schema/schema/attribute.rb
|
115
117
|
- lib/schema/schema/compare.rb
|