paquito 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +2 -2
- data/CHANGELOG.md +47 -0
- data/Gemfile.lock +4 -4
- data/lib/paquito/active_record_coder.rb +11 -3
- data/lib/paquito/version.rb +1 -1
- data/paquito.gemspec +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae7b47980ce61a6b1c3d650217d29a5c196df0c69470a36b74f643d0ded5334c
|
4
|
+
data.tar.gz: 06a85f164bcf5a0e472b4ebf41ce1a9680f71557663ed3176cb7e0df368e460b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fcc3454d84b6cfac7ffe5f3b33780fc23aa609cad375db0e35b43a28582fc3b5dbb6913fc1b3e991b1f034418abe9dbd8c0d673f28e591fc8dee001eefd7c1c
|
7
|
+
data.tar.gz: 2baa0d2518993e2e140f5e989ede70a0d9aa19edb2361414bb6375a6161db0424fcbf7ab03f8f8e531ff0cef9160ea2fa0708afb345b6d3f2d2b3dcdeec332fa
|
data/.github/workflows/ci.yml
CHANGED
@@ -9,7 +9,7 @@ jobs:
|
|
9
9
|
fail-fast: false
|
10
10
|
steps:
|
11
11
|
- name: Checkout
|
12
|
-
uses: actions/checkout@
|
12
|
+
uses: actions/checkout@v3
|
13
13
|
- name: Set up Ruby
|
14
14
|
uses: ruby/setup-ruby@v1
|
15
15
|
with:
|
@@ -26,7 +26,7 @@ jobs:
|
|
26
26
|
ruby: [ ruby-head, '3.0', '2.7', '2.6' ]
|
27
27
|
steps:
|
28
28
|
- name: Checkout
|
29
|
-
uses: actions/checkout@
|
29
|
+
uses: actions/checkout@v3
|
30
30
|
- name: Set up Ruby
|
31
31
|
uses: ruby/setup-ruby@v1
|
32
32
|
with:
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# Unreleased
|
2
|
+
|
3
|
+
# 0.7.0
|
4
|
+
|
5
|
+
* Make ActiveRecordCoder now encode wether records were persisted or not (#12).
|
6
|
+
This change is backward compatible with Paquito 0.6.2 but NOT OLDER VERSIONS.
|
7
|
+
|
8
|
+
# 0.6.2
|
9
|
+
|
10
|
+
* Make ActiveRecordCoder able to read payloads that will be generated by Paquito 0.7.0 (#12).
|
11
|
+
DO NOT upgrade to Paquito 0.7.0+ without first fully rolling out Paquito 0.6.2.
|
12
|
+
|
13
|
+
# 0.6.1
|
14
|
+
|
15
|
+
* No data
|
16
|
+
|
17
|
+
# 0.6.0
|
18
|
+
|
19
|
+
* No data
|
20
|
+
|
21
|
+
# 0.5.0
|
22
|
+
|
23
|
+
* No data
|
24
|
+
|
25
|
+
# 0.4.0
|
26
|
+
|
27
|
+
* No data
|
28
|
+
|
29
|
+
# 0.3.1
|
30
|
+
|
31
|
+
* No data
|
32
|
+
|
33
|
+
# 0.3.0
|
34
|
+
|
35
|
+
* No data
|
36
|
+
|
37
|
+
# 0.2.1
|
38
|
+
|
39
|
+
* No data
|
40
|
+
|
41
|
+
# 0.2.0
|
42
|
+
|
43
|
+
* No data
|
44
|
+
|
45
|
+
# 0.1.0
|
46
|
+
|
47
|
+
* No data
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
paquito (0.
|
5
|
-
msgpack (>= 1.5.
|
4
|
+
paquito (0.7.0)
|
5
|
+
msgpack (>= 1.5.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
@@ -25,7 +25,7 @@ GEM
|
|
25
25
|
i18n (1.10.0)
|
26
26
|
concurrent-ruby (~> 1.0)
|
27
27
|
minitest (5.15.0)
|
28
|
-
msgpack (1.5.
|
28
|
+
msgpack (1.5.4)
|
29
29
|
parallel (1.21.0)
|
30
30
|
parser (3.1.1.0)
|
31
31
|
ast (~> 2.4.1)
|
@@ -73,4 +73,4 @@ DEPENDENCIES
|
|
73
73
|
sqlite3
|
74
74
|
|
75
75
|
BUNDLED WITH
|
76
|
-
2.3.
|
76
|
+
2.3.8
|
@@ -4,6 +4,8 @@ require "paquito/errors"
|
|
4
4
|
|
5
5
|
module Paquito
|
6
6
|
class ActiveRecordCoder
|
7
|
+
EMPTY_HASH = {}.freeze
|
8
|
+
|
7
9
|
class << self
|
8
10
|
def dump(record)
|
9
11
|
instances = InstanceTracker.new
|
@@ -85,7 +87,9 @@ module Paquito
|
|
85
87
|
end
|
86
88
|
|
87
89
|
def serialize_record(record)
|
88
|
-
[record.class.name, attributes_for_database(record)]
|
90
|
+
arguments = [record.class.name, attributes_for_database(record)]
|
91
|
+
arguments << true if record.new_record?
|
92
|
+
arguments
|
89
93
|
end
|
90
94
|
|
91
95
|
def attributes_for_database(record)
|
@@ -94,13 +98,17 @@ module Paquito
|
|
94
98
|
attributes
|
95
99
|
end
|
96
100
|
|
97
|
-
def deserialize_record(class_name, attributes_from_database)
|
101
|
+
def deserialize_record(class_name, attributes_from_database, new_record = false)
|
98
102
|
begin
|
99
103
|
klass = Object.const_get(class_name)
|
100
104
|
rescue NameError
|
101
105
|
raise ClassMissingError, "undefined class: #{class_name}"
|
102
106
|
end
|
103
|
-
|
107
|
+
|
108
|
+
# Ideally we'd like to call `klass.instantiate`, however it doesn't allow to pass
|
109
|
+
# wether the record was persisted or not.
|
110
|
+
attributes = klass.attributes_builder.build_from_database(attributes_from_database, EMPTY_HASH)
|
111
|
+
klass.allocate.init_with_attributes(attributes, new_record)
|
104
112
|
end
|
105
113
|
end
|
106
114
|
|
data/lib/paquito/version.rb
CHANGED
data/paquito.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paquito
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Boussier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.5.
|
19
|
+
version: 1.5.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.5.
|
26
|
+
version: 1.5.2
|
27
27
|
description: Framework for defining efficient and extendable serializers
|
28
28
|
email:
|
29
29
|
- jean.boussier@gmail.com
|
@@ -34,6 +34,7 @@ files:
|
|
34
34
|
- ".github/workflows/ci.yml"
|
35
35
|
- ".gitignore"
|
36
36
|
- ".rubocop.yml"
|
37
|
+
- CHANGELOG.md
|
37
38
|
- Gemfile
|
38
39
|
- Gemfile.lock
|
39
40
|
- LICENSE.txt
|
@@ -85,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
86
|
- !ruby/object:Gem::Version
|
86
87
|
version: '0'
|
87
88
|
requirements: []
|
88
|
-
rubygems_version: 3.
|
89
|
+
rubygems_version: 3.3.3
|
89
90
|
signing_key:
|
90
91
|
specification_version: 4
|
91
92
|
summary: Framework for defining efficient and extendable serializers
|