evt-schema 2.2.4.2 → 2.2.6.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: 2d58d59e9ba7a13ceb827d3c92a6b33bcff78220070a2dd98b0ffacfd478d829
4
- data.tar.gz: f3eb48a36b7443db1c40aac6fc712145b7da32550a0a7bbd747a8cf57bc1189b
3
+ metadata.gz: 9299b9d03473151d2ac17454be8a3fa58a77ff2db066742d5930960b041340a1
4
+ data.tar.gz: b414f51b769f2efad19b78af1b4c3e8ac31ae855516f303de78c2d464e60a666
5
5
  SHA512:
6
- metadata.gz: 61a1bba3069dd5993b66e2e457446e2fa888941a31fc58d92724f2d20b689b73fff3d79f4a42327ee506d216a327448f7643e199cd53778ac3841963fc96fec6
7
- data.tar.gz: d4580b381a7d00591ec57fef475305e5dbe798f5667788043147b37b23d4876c8f2a43587b204cd7f5d5b8f8894f3cfbcc4316a15f4b28f2172906c89df838b9
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
- module Proc
128
- class Example
129
- include ::Schema
130
- attribute :some_attribute, default: proc { 'some default value' }
131
- end
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
- virtual :transform_read
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
@@ -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
@@ -8,7 +8,11 @@ module Schema
8
8
  extend Attributes
9
9
 
10
10
  include Virtual
11
- virtual :transform_write
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, 'Control object is not an implementation of Schema'
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, 'Compare object is not an implementation of Schema'
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.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-13 00:00:00.000000000 Z
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