evt-schema 2.2.4.0 → 2.2.5.0

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: 42c0ba35a8f9d61ef11d61b103d4c7c37d747475dfb56d72674cbb497b663cfe
4
- data.tar.gz: ee145e7df6483dd0afcf0ca6754eceda6078b182d6486a0a055b9191c628dca8
3
+ metadata.gz: 11db0e0940b27bbf03b4e30ce0e769d3997078402f7cacd3dd865798a05c011c
4
+ data.tar.gz: d6b5aefdbb44f3a0dbafe9b80cd804d6f35043f1703c74ad3b8cfc1fe200b57b
5
5
  SHA512:
6
- metadata.gz: 11aec5d0798a7fcbf2be9673600fb3b704b8630ffa0caaff7e50915142f15de180f5a0a621fab59deab2e4265d656db669a4db329e42c0b5519eff6e767161c9
7
- data.tar.gz: 4c2a27e05c3a2978fd788f75a1d1e7c2181286ad430e6c58176b73917160a606b5350d30faf31092adcccb2882e50c9799efe54fc61e9603ff5d095ec215bf5d
6
+ metadata.gz: 20a2f86f42dbcbf0846bfa33a9f2cf82c62028e42f1995c82188c3f3e656212edff18f63b45107cab497e421ac2879e26669dd04f489fea7992dc366ec3959e9
7
+ data.tar.gz: 77b65107b983cabc8dbac513992d7705cf03a5e460c25311c1ef3d59951df185b95ed8042f19eaea4edde790fbd1901aa68f65088e38e19d4d3564816a88e6f0
@@ -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
@@ -114,9 +114,14 @@ module Schema
114
114
  end
115
115
 
116
116
  module DefaultValue
117
+ def self.example
118
+ Example.new
119
+ end
120
+
117
121
  class Example
118
122
  include ::Schema
119
123
  attribute :some_attribute, default: 'some default value'
124
+ attribute :some_other_attribute
120
125
  end
121
126
 
122
127
  module Proc
@@ -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,10 @@ module Schema
34
38
  end
35
39
  end
36
40
  end
41
+
42
+ def dup
43
+ data = to_h
44
+ self.class.build(data)
45
+ end
37
46
  end
38
47
  end
@@ -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
@@ -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.0
4
+ version: 2.2.5.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: 2020-07-11 00:00:00.000000000 Z
11
+ date: 2020-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: evt-attribute