active_type 1.4.2 → 1.5.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/test.yml +181 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile.3.2.mysql2 +1 -1
- data/Gemfile.3.2.mysql2.lock +10 -4
- data/Gemfile.3.2.sqlite3.lock +2 -2
- data/Gemfile.4.2.mysql2 +1 -1
- data/Gemfile.4.2.mysql2.lock +4 -4
- data/Gemfile.4.2.pg.lock +2 -2
- data/Gemfile.4.2.sqlite3.lock +2 -2
- data/Gemfile.5.2.mysql2.lock +3 -3
- data/Gemfile.5.2.pg.lock +2 -2
- data/Gemfile.5.2.sqlite3.lock +2 -2
- data/Gemfile.6.0.pg.lock +2 -2
- data/README.md +1 -1
- data/lib/active_type/version.rb +1 -1
- data/lib/active_type/virtual_attributes.rb +18 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b89a8dd55842409c9f14b641fcb0d6efa2f090cb4c01507f72ff5f77bd415af
|
4
|
+
data.tar.gz: 48bcc880f21b98af413ff99f53a980d435b06cf07397c7487d7a3f8d3599cee8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a6dff5a37816e2e71dd66f1300354cc7989aabc7cdd1ea188290a91b2957c1589231631bf1a36598d5dc9bbff76648be4dd71e59958fe3de8d3f9d9acabdc7c
|
7
|
+
data.tar.gz: 7a75c3faaf91db7326f6147375c08f334f776b24720caf44370e2b197d857213204c4a3d94993ad53cfb083181ed508ce6edf266fbbbaabe49acbe2393acd57f
|
@@ -0,0 +1,181 @@
|
|
1
|
+
name: Tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test_sqlite:
|
11
|
+
runs-on: ubuntu-20.04
|
12
|
+
|
13
|
+
strategy:
|
14
|
+
fail-fast: false
|
15
|
+
matrix:
|
16
|
+
ruby:
|
17
|
+
- "2.3.8"
|
18
|
+
- "2.4.6"
|
19
|
+
- "2.5.5"
|
20
|
+
- "2.6.3"
|
21
|
+
gemfile:
|
22
|
+
- Gemfile.3.2.sqlite3
|
23
|
+
- Gemfile.4.2.sqlite3
|
24
|
+
- Gemfile.5.2.sqlite3
|
25
|
+
exclude:
|
26
|
+
- ruby: "2.4.6"
|
27
|
+
gemfile: Gemfile.3.2.sqlite3
|
28
|
+
- ruby: "2.5.5"
|
29
|
+
gemfile: Gemfile.3.2.sqlite3
|
30
|
+
- ruby: "2.5.5"
|
31
|
+
gemfile: Gemfile.4.2.sqlite3
|
32
|
+
- ruby: "2.6.3"
|
33
|
+
gemfile: Gemfile.3.2.sqlite3
|
34
|
+
- ruby: "2.6.3"
|
35
|
+
gemfile: Gemfile.4.2.sqlite3
|
36
|
+
|
37
|
+
env:
|
38
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
39
|
+
|
40
|
+
steps:
|
41
|
+
- uses: actions/checkout@v2
|
42
|
+
- name: Install ruby
|
43
|
+
uses: ruby/setup-ruby@v1
|
44
|
+
with:
|
45
|
+
ruby-version: ${{ matrix.ruby }}
|
46
|
+
- name: Bundle
|
47
|
+
run: |
|
48
|
+
gem install bundler:2.0.2
|
49
|
+
bundle install --no-deployment
|
50
|
+
- name: Run tests
|
51
|
+
run: bundle exec rake spec
|
52
|
+
|
53
|
+
|
54
|
+
test_mysql:
|
55
|
+
runs-on: ubuntu-20.04
|
56
|
+
|
57
|
+
services:
|
58
|
+
mysql:
|
59
|
+
image: mysql:5.6
|
60
|
+
env:
|
61
|
+
MYSQL_ROOT_PASSWORD: password
|
62
|
+
ports:
|
63
|
+
- 3306:3306
|
64
|
+
options: >-
|
65
|
+
--health-cmd="mysqladmin ping"
|
66
|
+
--health-interval=10s
|
67
|
+
--health-timeout=5s
|
68
|
+
--health-retries=3
|
69
|
+
|
70
|
+
strategy:
|
71
|
+
fail-fast: false
|
72
|
+
matrix:
|
73
|
+
ruby:
|
74
|
+
- "2.3.8"
|
75
|
+
- "2.4.6"
|
76
|
+
- "2.5.5"
|
77
|
+
- "2.6.3"
|
78
|
+
gemfile:
|
79
|
+
- Gemfile.3.2.mysql2
|
80
|
+
- Gemfile.4.2.mysql2
|
81
|
+
- Gemfile.5.2.mysql2
|
82
|
+
exclude:
|
83
|
+
- ruby: "2.4.6"
|
84
|
+
gemfile: Gemfile.3.2.mysql2
|
85
|
+
- ruby: "2.4.6"
|
86
|
+
gemfile: Gemfile.4.2.mysql2
|
87
|
+
- ruby: "2.4.6"
|
88
|
+
gemfile: Gemfile.5.2.mysql2
|
89
|
+
- ruby: "2.5.5"
|
90
|
+
gemfile: Gemfile.3.2.mysql2
|
91
|
+
- ruby: "2.5.5"
|
92
|
+
gemfile: Gemfile.4.2.mysql2
|
93
|
+
- ruby: "2.5.5"
|
94
|
+
gemfile: Gemfile.5.2.mysql2
|
95
|
+
- ruby: "2.6.3"
|
96
|
+
gemfile: Gemfile.3.2.mysql2
|
97
|
+
- ruby: "2.6.3"
|
98
|
+
gemfile: Gemfile.4.2.mysql2
|
99
|
+
|
100
|
+
env:
|
101
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
102
|
+
|
103
|
+
steps:
|
104
|
+
- uses: actions/checkout@v2
|
105
|
+
- name: Install ruby
|
106
|
+
uses: ruby/setup-ruby@v1
|
107
|
+
with:
|
108
|
+
ruby-version: ${{ matrix.ruby }}
|
109
|
+
- name: Install database client
|
110
|
+
run: |
|
111
|
+
sudo apt-get update
|
112
|
+
sudo apt-get install -y mysql-client libmariadbclient-dev
|
113
|
+
- name: Bundle
|
114
|
+
run: |
|
115
|
+
gem install bundler:2.0.2
|
116
|
+
bundle install --no-deployment
|
117
|
+
- name: Setup databases
|
118
|
+
run: |
|
119
|
+
mysql -e 'create database IF NOT EXISTS active_type_test;' -u root --password=password -P 3306 -h 127.0.0.1
|
120
|
+
- name: Run tests
|
121
|
+
run: bundle exec rake spec
|
122
|
+
|
123
|
+
|
124
|
+
test_pg:
|
125
|
+
runs-on: ubuntu-20.04
|
126
|
+
|
127
|
+
services:
|
128
|
+
postgres:
|
129
|
+
image: postgres
|
130
|
+
env:
|
131
|
+
POSTGRES_PASSWORD: postgres
|
132
|
+
options: >-
|
133
|
+
--health-cmd pg_isready
|
134
|
+
--health-interval 10s
|
135
|
+
--health-timeout 5s
|
136
|
+
--health-retries 5
|
137
|
+
ports:
|
138
|
+
- 5432:5432
|
139
|
+
|
140
|
+
strategy:
|
141
|
+
fail-fast: false
|
142
|
+
matrix:
|
143
|
+
ruby:
|
144
|
+
- "2.3.8"
|
145
|
+
- "2.5.5"
|
146
|
+
- "2.6.3"
|
147
|
+
gemfile:
|
148
|
+
- Gemfile.4.2.pg
|
149
|
+
- Gemfile.5.2.pg
|
150
|
+
- Gemfile.6.0.pg
|
151
|
+
exclude:
|
152
|
+
- ruby: "2.3.8"
|
153
|
+
gemfile: Gemfile.6.0.pg
|
154
|
+
- ruby: "2.5.5"
|
155
|
+
gemfile: Gemfile.4.2.pg
|
156
|
+
- ruby: "2.5.5"
|
157
|
+
gemfile: Gemfile.5.2.pg
|
158
|
+
- ruby: "2.6.3"
|
159
|
+
gemfile: Gemfile.4.2.pg
|
160
|
+
|
161
|
+
env:
|
162
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
163
|
+
|
164
|
+
steps:
|
165
|
+
- uses: actions/checkout@v2
|
166
|
+
- name: Install ruby
|
167
|
+
uses: ruby/setup-ruby@v1
|
168
|
+
with:
|
169
|
+
ruby-version: ${{ matrix.ruby }}
|
170
|
+
- name: Install database client
|
171
|
+
run: |
|
172
|
+
sudo apt-get install -y postgresql-client
|
173
|
+
- name: Bundle
|
174
|
+
run: |
|
175
|
+
gem install bundler:2.0.2
|
176
|
+
bundle install --no-deployment
|
177
|
+
- name: Setup databases
|
178
|
+
run: |
|
179
|
+
PGPASSWORD=postgres psql -c 'create database active_type_test;' -U postgres -p 5432 -h localhost
|
180
|
+
- name: Run tests
|
181
|
+
run: bundle exec rake spec
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
|
5
5
|
## Unreleased changes
|
6
6
|
|
7
|
+
## 1.5.0 (2020-11-06)
|
8
|
+
|
9
|
+
* Added: When serializing/deserializing `ActiveType::Record` or `ActiveType::Object` with YAML, virtual attributes are restored.
|
10
|
+
Credits to @chriscz.
|
11
|
+
|
7
12
|
## 1.4.2 (2020-09-17)
|
8
13
|
|
9
14
|
* Fixed: Assigning values to virtual attributes through internal setter methods (e.g. `_write_attribute`) no longer results in "can't write unknown attribute" errors.
|
data/Gemfile.3.2.mysql2
CHANGED
data/Gemfile.3.2.mysql2.lock
CHANGED
@@ -1,7 +1,14 @@
|
|
1
|
+
GIT
|
2
|
+
remote: https://github.com/makandra/mysql2
|
3
|
+
revision: c920d41e43c4722d4c065d2ea9d21494c560bd85
|
4
|
+
branch: 0.3.x-lts
|
5
|
+
specs:
|
6
|
+
mysql2 (0.3.21)
|
7
|
+
|
1
8
|
PATH
|
2
9
|
remote: .
|
3
10
|
specs:
|
4
|
-
active_type (1.
|
11
|
+
active_type (1.5.0)
|
5
12
|
activerecord (>= 3.2)
|
6
13
|
|
7
14
|
GEM
|
@@ -21,10 +28,9 @@ GEM
|
|
21
28
|
arel (3.0.3)
|
22
29
|
builder (3.0.4)
|
23
30
|
diff-lcs (1.2.5)
|
24
|
-
gemika (0.
|
31
|
+
gemika (0.4.1)
|
25
32
|
i18n (0.6.11)
|
26
33
|
multi_json (1.13.1)
|
27
|
-
mysql2 (0.3.17)
|
28
34
|
rake (10.4.2)
|
29
35
|
rspec (3.4.0)
|
30
36
|
rspec-core (~> 3.4.0)
|
@@ -49,7 +55,7 @@ DEPENDENCIES
|
|
49
55
|
activerecord (~> 3.2.22.5)
|
50
56
|
gemika
|
51
57
|
i18n (= 0.6.11)
|
52
|
-
mysql2
|
58
|
+
mysql2!
|
53
59
|
rake
|
54
60
|
rspec (~> 3.4)
|
55
61
|
|
data/Gemfile.3.2.sqlite3.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
active_type (1.
|
4
|
+
active_type (1.5.0)
|
5
5
|
activerecord (>= 3.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -21,7 +21,7 @@ GEM
|
|
21
21
|
arel (3.0.3)
|
22
22
|
builder (3.0.4)
|
23
23
|
diff-lcs (1.2.5)
|
24
|
-
gemika (0.
|
24
|
+
gemika (0.4.1)
|
25
25
|
i18n (0.6.11)
|
26
26
|
multi_json (1.13.1)
|
27
27
|
rake (10.4.2)
|
data/Gemfile.4.2.mysql2
CHANGED
data/Gemfile.4.2.mysql2.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
active_type (1.
|
4
|
+
active_type (1.5.0)
|
5
5
|
activerecord (>= 3.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -23,11 +23,11 @@ GEM
|
|
23
23
|
builder (3.2.3)
|
24
24
|
concurrent-ruby (1.1.4)
|
25
25
|
diff-lcs (1.2.5)
|
26
|
-
gemika (0.
|
26
|
+
gemika (0.4.1)
|
27
27
|
i18n (0.9.5)
|
28
28
|
concurrent-ruby (~> 1.0)
|
29
29
|
minitest (5.11.3)
|
30
|
-
mysql2 (0.3
|
30
|
+
mysql2 (0.5.3)
|
31
31
|
rake (10.4.2)
|
32
32
|
rspec (3.4.0)
|
33
33
|
rspec-core (~> 3.4.0)
|
@@ -53,7 +53,7 @@ DEPENDENCIES
|
|
53
53
|
active_type!
|
54
54
|
activerecord (~> 4.2.1)
|
55
55
|
gemika
|
56
|
-
mysql2
|
56
|
+
mysql2
|
57
57
|
rake
|
58
58
|
rspec (~> 3.4)
|
59
59
|
|
data/Gemfile.4.2.pg.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
active_type (1.
|
4
|
+
active_type (1.5.0)
|
5
5
|
activerecord (>= 3.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -23,7 +23,7 @@ GEM
|
|
23
23
|
builder (3.2.3)
|
24
24
|
concurrent-ruby (1.1.4)
|
25
25
|
diff-lcs (1.2.5)
|
26
|
-
gemika (0.
|
26
|
+
gemika (0.4.1)
|
27
27
|
i18n (0.9.5)
|
28
28
|
concurrent-ruby (~> 1.0)
|
29
29
|
minitest (5.11.3)
|
data/Gemfile.4.2.sqlite3.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
active_type (1.
|
4
|
+
active_type (1.5.0)
|
5
5
|
activerecord (>= 3.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -23,7 +23,7 @@ GEM
|
|
23
23
|
builder (3.2.3)
|
24
24
|
concurrent-ruby (1.1.4)
|
25
25
|
diff-lcs (1.2.5)
|
26
|
-
gemika (0.
|
26
|
+
gemika (0.4.1)
|
27
27
|
i18n (0.9.5)
|
28
28
|
concurrent-ruby (~> 1.0)
|
29
29
|
minitest (5.11.3)
|
data/Gemfile.5.2.mysql2.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
active_type (1.
|
4
|
+
active_type (1.5.0)
|
5
5
|
activerecord (>= 3.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -21,11 +21,11 @@ GEM
|
|
21
21
|
arel (8.0.0)
|
22
22
|
concurrent-ruby (1.1.4)
|
23
23
|
diff-lcs (1.3)
|
24
|
-
gemika (0.
|
24
|
+
gemika (0.4.1)
|
25
25
|
i18n (1.5.3)
|
26
26
|
concurrent-ruby (~> 1.0)
|
27
27
|
minitest (5.11.3)
|
28
|
-
mysql2 (0.
|
28
|
+
mysql2 (0.5.3)
|
29
29
|
rake (12.0.0)
|
30
30
|
rspec (3.6.0)
|
31
31
|
rspec-core (~> 3.6.0)
|
data/Gemfile.5.2.pg.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
active_type (1.
|
4
|
+
active_type (1.5.0)
|
5
5
|
activerecord (>= 3.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -21,7 +21,7 @@ GEM
|
|
21
21
|
arel (8.0.0)
|
22
22
|
concurrent-ruby (1.1.4)
|
23
23
|
diff-lcs (1.3)
|
24
|
-
gemika (0.
|
24
|
+
gemika (0.4.1)
|
25
25
|
i18n (1.5.3)
|
26
26
|
concurrent-ruby (~> 1.0)
|
27
27
|
minitest (5.11.3)
|
data/Gemfile.5.2.sqlite3.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
active_type (1.
|
4
|
+
active_type (1.5.0)
|
5
5
|
activerecord (>= 3.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -21,7 +21,7 @@ GEM
|
|
21
21
|
arel (8.0.0)
|
22
22
|
concurrent-ruby (1.1.4)
|
23
23
|
diff-lcs (1.3)
|
24
|
-
gemika (0.
|
24
|
+
gemika (0.4.1)
|
25
25
|
i18n (1.5.3)
|
26
26
|
concurrent-ruby (~> 1.0)
|
27
27
|
minitest (5.11.3)
|
data/Gemfile.6.0.pg.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
active_type (1.
|
4
|
+
active_type (1.5.0)
|
5
5
|
activerecord (>= 3.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -20,7 +20,7 @@ GEM
|
|
20
20
|
zeitwerk (~> 2.1, >= 2.1.8)
|
21
21
|
concurrent-ruby (1.1.5)
|
22
22
|
diff-lcs (1.3)
|
23
|
-
gemika (0.
|
23
|
+
gemika (0.4.1)
|
24
24
|
i18n (1.6.0)
|
25
25
|
concurrent-ruby (~> 1.0)
|
26
26
|
minitest (5.11.3)
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
ActiveType [![
|
1
|
+
ActiveType [![Tests](https://github.com/makandra/active_type/workflows/Tests/badge.svg)](https://github.com/makandra/active_type/actions)
|
2
2
|
==========
|
3
3
|
|
4
4
|
Make any Ruby object quack like ActiveRecord
|
data/lib/active_type/version.rb
CHANGED
@@ -8,6 +8,23 @@ module ActiveType
|
|
8
8
|
|
9
9
|
module VirtualAttributes
|
10
10
|
|
11
|
+
module Serialization
|
12
|
+
extend ActiveSupport::Concern
|
13
|
+
|
14
|
+
def init_with(coder)
|
15
|
+
if coder['virtual_attributes'].present?
|
16
|
+
@virtual_attributes = coder['virtual_attributes']
|
17
|
+
end
|
18
|
+
super(coder)
|
19
|
+
end
|
20
|
+
|
21
|
+
def encode_with(coder)
|
22
|
+
coder['virtual_attributes'] = @virtual_attributes
|
23
|
+
coder['active_type_yaml_version'] = 1
|
24
|
+
super(coder)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
11
28
|
class VirtualColumn
|
12
29
|
|
13
30
|
def initialize(name, type_caster, options)
|
@@ -110,10 +127,10 @@ module ActiveType
|
|
110
127
|
result
|
111
128
|
end
|
112
129
|
|
113
|
-
|
114
130
|
extend ActiveSupport::Concern
|
115
131
|
|
116
132
|
included do
|
133
|
+
include ActiveType::VirtualAttributes::Serialization
|
117
134
|
class_attribute :virtual_columns_hash
|
118
135
|
self.virtual_columns_hash = {}
|
119
136
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_type
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Kraze
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-11-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -59,6 +59,7 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
+
- ".github/workflows/test.yml"
|
62
63
|
- ".gitignore"
|
63
64
|
- ".rspec"
|
64
65
|
- ".ruby-version"
|
@@ -123,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
124
|
- !ruby/object:Gem::Version
|
124
125
|
version: '0'
|
125
126
|
requirements: []
|
126
|
-
rubygems_version: 3.
|
127
|
+
rubygems_version: 3.1.4
|
127
128
|
signing_key:
|
128
129
|
specification_version: 4
|
129
130
|
summary: Make any Ruby object quack like ActiveRecord
|