evt-entity_cache 2.0.1.1 → 2.0.1.2

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: 4ccf37e36c243d747764757e86a6552c649f157b1feabb174fd025d4019ecdff
4
- data.tar.gz: 41ab27c85c699eacffd6cca4122eb44db0fa537a5ff033f73eca29ace4937f16
3
+ metadata.gz: 0a65dee7e03fdffdece4718fe1d50e5cdf3f5e59466dfb224068b84c8356b6fc
4
+ data.tar.gz: b5f966733c02ad8280f954d10226ae99656788514d522e66e3b7750b1670ed62
5
5
  SHA512:
6
- metadata.gz: 96bfc7773f4e5e34c307315c8de52e2741b933c9f75bc49e7d96f34df3ac5dd5e024b4c8964c12afc019cc1fd8fbd675ca3dae069b220751fee89a215f1a0c4e
7
- data.tar.gz: eb9c2b7ace7f89be4c7fd035a8b405b4be8c01b058f22fd694b0de0398a83295d364185c7950ae3b2b194e358100e90179d168c34ce482b10da3bb5bd3ac481b
6
+ metadata.gz: bad5d326c349c724b90b47fc8e4c5bfbf9c6558be071d9a61b1363266284a084b4a4ff2e5cde5eeb9596570252927e7cbb8038e610f3d9d5d4229e4232384072
7
+ data.tar.gz: fc18bafad76966151ff5029c4af0996e1b763113efc50a47e7f740f2c94b5030fc58bbe0fac5e8a73617e4014f20ea65bcba755e754d9762e26302541c02b827
@@ -18,13 +18,9 @@ class EntityCache
18
18
 
19
19
  text = File.read(path)
20
20
 
21
- entity_data, version, time_iso8601 = YAML.load(text)
21
+ entity_data, version, time_iso8601 = JSON.parse(text, symbolize_names: true)
22
22
 
23
- entity = Entity::Example.new(
24
- entity_data[:id],
25
- entity_data[:some_attr],
26
- entity_data[:other_attr]
27
- )
23
+ entity = Entity::Example.new(*entity_data)
28
24
 
29
25
  time = Clock.parse(time_iso8601)
30
26
 
@@ -34,11 +30,17 @@ class EntityCache
34
30
  def put(id, entity, version, time)
35
31
  path = path(id)
36
32
 
37
- entity_data = entity.to_h
33
+ entity_data = Transform::Write.raw_data(entity)
38
34
 
39
35
  time_iso8601 = Clock.iso8601(time)
40
36
 
41
- text = YAML.dump([entity_data, version, time_iso8601])
37
+ data = [
38
+ entity_data,
39
+ version,
40
+ time_iso8601
41
+ ]
42
+
43
+ text = JSON.generate(data)
42
44
 
43
45
  File.write(path, text)
44
46
  end
@@ -6,15 +6,18 @@ class EntityCache
6
6
  def self.call
7
7
  subject = Subject.example
8
8
 
9
- entity_data = Controls::Entity.example.to_h
9
+ entity = Controls::Entity.example
10
+ entity_data = Transform::Write.raw_data(entity)
10
11
 
11
12
  persisted_time_iso8601 = Controls::Record.persisted_time.iso8601(5)
12
13
 
13
- text = YAML.dump([
14
+ data = [
14
15
  entity_data,
15
16
  Controls::Record.persisted_version,
16
17
  persisted_time_iso8601
17
- ])
18
+ ]
19
+
20
+ text = JSON.generate(data)
18
21
 
19
22
  path = External.path(subject)
20
23
 
@@ -1,4 +1,4 @@
1
- require 'yaml'
1
+ require 'json'
2
2
  require 'tmpdir'
3
3
 
4
4
  require 'clock/controls'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evt-entity_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1.1
4
+ version: 2.0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Eventide Project
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  - !ruby/object:Gem::Version
142
142
  version: '0'
143
143
  requirements: []
144
- rubygems_version: 3.3.3
144
+ rubygems_version: 3.3.4
145
145
  signing_key:
146
146
  specification_version: 4
147
147
  summary: Cache of entities retrieved by an entity-store, with in-memory temporary