jsonb_accessor 1.3.6 → 1.3.8
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 +64 -19
- data/.rubocop.yml +2 -0
- data/.ruby-version +1 -1
- data/Appraisals +8 -0
- data/CHANGELOG.md +9 -0
- data/Gemfile +0 -3
- data/README.md +6 -0
- data/docker-compose.yml +1 -1
- data/gemfiles/activerecord_5.0.0.gemfile +0 -1
- data/gemfiles/activerecord_5.1.0.gemfile +0 -1
- data/gemfiles/activerecord_5.2.0.gemfile +7 -0
- data/gemfiles/activerecord_6.0.0.gemfile +7 -0
- data/gemfiles/activerecord_6.1.0.gemfile +0 -1
- data/gemfiles/activerecord_7.0.1.gemfile +0 -1
- data/jsonb_accessor.gemspec +8 -1
- data/lib/jsonb_accessor/macro.rb +3 -1
- data/lib/jsonb_accessor/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc33a0dd7ef12bf1804fd787f0f8cfa8e8ddc7ee3973c6dd0fb1a172a6d3342c
|
4
|
+
data.tar.gz: 2defa503de6becb46bc44be77e52ba2f42073e33cb142e5ac07f6ca396f6c38c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd0b9dfc9b5d595c5c3c03ee7eb75050eb3755329010c1f7ad4df81f466f4b19717aa4ab4ef628fc49a71dc3134f95bb64202b993fc18b1413c0267bbbe37221
|
7
|
+
data.tar.gz: 762df4f22bc02d367ee20cee9056deabcdc0782a1afeb3592a992227cbcedb8ec9dec6d9aa38d998fe61fa9f42f53c79dd1036426d925d3e3568f39f0e82bf6b
|
data/.github/workflows/ci.yml
CHANGED
@@ -10,12 +10,11 @@ jobs:
|
|
10
10
|
lint:
|
11
11
|
runs-on: ubuntu-latest
|
12
12
|
steps:
|
13
|
-
- uses: actions/checkout@
|
13
|
+
- uses: actions/checkout@v3
|
14
14
|
|
15
15
|
- name: Set up Ruby
|
16
16
|
uses: ruby/setup-ruby@v1
|
17
17
|
with:
|
18
|
-
ruby-version: 2.7.2
|
19
18
|
bundler-cache: true
|
20
19
|
|
21
20
|
- name: Rubocop
|
@@ -38,54 +37,100 @@ jobs:
|
|
38
37
|
matrix:
|
39
38
|
include:
|
40
39
|
- gemfile: activerecord_5.0.0
|
41
|
-
ruby: 2.4
|
40
|
+
ruby: '2.4'
|
42
41
|
|
43
42
|
- gemfile: activerecord_5.1.0
|
44
|
-
ruby: 2.4
|
43
|
+
ruby: '2.4'
|
44
|
+
|
45
|
+
- gemfile: activerecord_5.2.0
|
46
|
+
ruby: '2.4'
|
45
47
|
|
46
48
|
- gemfile: activerecord_5.0.0
|
47
|
-
ruby: 2.5
|
49
|
+
ruby: '2.5'
|
48
50
|
|
49
51
|
- gemfile: activerecord_5.1.0
|
50
|
-
ruby: 2.5
|
52
|
+
ruby: '2.5'
|
53
|
+
|
54
|
+
- gemfile: activerecord_5.2.0
|
55
|
+
ruby: '2.5'
|
56
|
+
|
57
|
+
- gemfile: activerecord_6.0.0
|
58
|
+
ruby: '2.5'
|
51
59
|
|
52
60
|
- gemfile: activerecord_6.1.0
|
53
|
-
ruby: 2.5
|
61
|
+
ruby: '2.5'
|
54
62
|
|
55
63
|
- gemfile: activerecord_5.0.0
|
56
|
-
ruby: 2.6
|
64
|
+
ruby: '2.6'
|
57
65
|
|
58
66
|
- gemfile: activerecord_5.1.0
|
59
|
-
ruby: 2.6
|
67
|
+
ruby: '2.6'
|
68
|
+
|
69
|
+
- gemfile: activerecord_5.2.0
|
70
|
+
ruby: '2.6'
|
71
|
+
|
72
|
+
- gemfile: activerecord_6.0.0
|
73
|
+
ruby: '2.6'
|
60
74
|
|
61
75
|
- gemfile: activerecord_6.1.0
|
62
|
-
ruby: 2.6
|
76
|
+
ruby: '2.6'
|
63
77
|
|
64
78
|
- gemfile: activerecord_5.0.0
|
65
|
-
ruby: 2.7
|
79
|
+
ruby: '2.7'
|
66
80
|
|
67
81
|
- gemfile: activerecord_5.1.0
|
68
|
-
ruby: 2.7
|
82
|
+
ruby: '2.7'
|
83
|
+
|
84
|
+
- gemfile: activerecord_5.2.0
|
85
|
+
ruby: '2.7'
|
86
|
+
|
87
|
+
- gemfile: activerecord_6.0.0
|
88
|
+
ruby: '2.7'
|
69
89
|
|
70
90
|
- gemfile: activerecord_6.1.0
|
71
|
-
ruby: 2.7
|
91
|
+
ruby: '2.7'
|
72
92
|
|
73
93
|
- gemfile: activerecord_7.0.1
|
74
|
-
ruby: 2.7
|
94
|
+
ruby: '2.7'
|
95
|
+
|
96
|
+
- gemfile: activerecord_6.1.0
|
97
|
+
ruby: '3.0'
|
98
|
+
|
99
|
+
- gemfile: activerecord_6.1.0
|
100
|
+
ruby: '3.1'
|
75
101
|
|
76
102
|
- gemfile: activerecord_6.1.0
|
77
|
-
ruby: 3.
|
103
|
+
ruby: '3.2'
|
104
|
+
|
105
|
+
- gemfile: activerecord_7.0.1
|
106
|
+
ruby: '3.0'
|
78
107
|
|
79
108
|
- gemfile: activerecord_7.0.1
|
80
|
-
ruby: 3.
|
109
|
+
ruby: '3.1'
|
81
110
|
|
82
111
|
- gemfile: activerecord_7.0.1
|
83
|
-
ruby: 3.
|
112
|
+
ruby: '3.2'
|
113
|
+
|
114
|
+
- gemfile: activerecord_5.1.0
|
115
|
+
ruby: 'jruby-9.3'
|
116
|
+
|
117
|
+
- gemfile: activerecord_5.2.0
|
118
|
+
ruby: 'jruby-9.3'
|
119
|
+
|
120
|
+
- gemfile: activerecord_6.0.0
|
121
|
+
ruby: 'jruby-9.3'
|
122
|
+
|
123
|
+
- gemfile: activerecord_6.1.0
|
124
|
+
ruby: 'jruby-9.3'
|
125
|
+
|
126
|
+
# waiting for https://github.com/jruby/activerecord-jdbc-adapter/issues/1125 to be addressed
|
127
|
+
# - gemfile: activerecord_7.0.1
|
128
|
+
# ruby: 'jruby-9.4'
|
84
129
|
|
85
130
|
name: ${{ matrix.gemfile }}, ruby ${{ matrix.ruby }}
|
86
131
|
|
87
132
|
steps:
|
88
|
-
- uses: actions/checkout@
|
133
|
+
- uses: actions/checkout@v3
|
89
134
|
|
90
135
|
- name: Set up Ruby
|
91
136
|
uses: ruby/setup-ruby@v1
|
@@ -100,7 +145,7 @@ jobs:
|
|
100
145
|
|
101
146
|
- name: Setup DB
|
102
147
|
run: |
|
103
|
-
bundle exec rake db:
|
148
|
+
bundle exec rake db:schema:load
|
104
149
|
|
105
150
|
- name: Run tests
|
106
151
|
run: |
|
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
3.2.1
|
data/Appraisals
CHANGED
@@ -8,6 +8,14 @@ appraise "activerecord-5.1.0" do
|
|
8
8
|
gem "activerecord", "~> 5.1.3"
|
9
9
|
end
|
10
10
|
|
11
|
+
appraise "activerecord-5.2.0" do
|
12
|
+
gem "activerecord", "~> 5.2.8"
|
13
|
+
end
|
14
|
+
|
15
|
+
appraise "activerecord-6.0.0" do
|
16
|
+
gem "activerecord", "~> 6.0.6"
|
17
|
+
end
|
18
|
+
|
11
19
|
appraise "activerecord-6.1.0" do
|
12
20
|
gem "activerecord", "~> 6.1"
|
13
21
|
end
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,15 @@
|
|
1
1
|
# Changelog
|
2
2
|
## [Unreleased]
|
3
3
|
|
4
|
+
## [1.3.8] - 2023-05-29
|
5
|
+
### Fixes
|
6
|
+
|
7
|
+
- Support for ActiveRecord::Enum. [#163](https://github.com/madeintandem/jsonb_accessor/pull/163)
|
8
|
+
|
9
|
+
## [1.3.7] - 2022-12-29
|
10
|
+
|
11
|
+
- jruby support. jsonb_accessor now depends on `activerecord-jdbcpostgresql-adapter` instead of `pg` when the RUBY_PLATFORM is java. [#157](https://github.com/madeintandem/jsonb_accessor/pull/157)
|
12
|
+
|
4
13
|
## [1.3.6] - 2022-09-23
|
5
14
|
### Fixed
|
6
15
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -353,3 +353,9 @@ docker-compose run ruby rake spec
|
|
353
353
|
4. Commit your changes (`git commit -am 'Add some feature'`)
|
354
354
|
5. Push to the branch (`git push origin my-new-feature`)
|
355
355
|
6. Create a new Pull Request
|
356
|
+
|
357
|
+
## Alternatives
|
358
|
+
|
359
|
+
- https://github.com/DmitryTsepelev/store_model 💪
|
360
|
+
- https://github.com/palkan/store_attribute ❤️
|
361
|
+
- https://github.com/jrochkind/attr_json 🤩
|
data/docker-compose.yml
CHANGED
data/jsonb_accessor.gemspec
CHANGED
@@ -4,11 +4,14 @@ lib = File.expand_path("lib", __dir__)
|
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
5
|
require "jsonb_accessor/version"
|
6
6
|
|
7
|
+
is_java = RUBY_PLATFORM == "java"
|
8
|
+
|
7
9
|
Gem::Specification.new do |spec|
|
8
10
|
spec.name = "jsonb_accessor"
|
9
11
|
spec.version = JsonbAccessor::VERSION
|
10
12
|
spec.authors = ["Michael Crismali", "Joe Hirn", "Jason Haruska"]
|
11
13
|
spec.email = ["michael@crismali.com", "joe@devmynd.com", "jason@haruska.com"]
|
14
|
+
spec.platform = "java" if is_java
|
12
15
|
|
13
16
|
spec.summary = "Adds typed jsonb backed fields to your ActiveRecord models."
|
14
17
|
spec.description = "Adds typed jsonb backed fields to your ActiveRecord models."
|
@@ -23,7 +26,11 @@ Gem::Specification.new do |spec|
|
|
23
26
|
|
24
27
|
spec.add_dependency "activerecord", ">= 5.0"
|
25
28
|
spec.add_dependency "activesupport", ">= 5.0"
|
26
|
-
|
29
|
+
if is_java
|
30
|
+
spec.add_dependency "activerecord-jdbcpostgresql-adapter", ">= 50.0"
|
31
|
+
else
|
32
|
+
spec.add_dependency "pg", ">= 0.18.1"
|
33
|
+
end
|
27
34
|
|
28
35
|
spec.add_development_dependency "appraisal", "~> 2.2.0"
|
29
36
|
spec.add_development_dependency "awesome_print"
|
data/lib/jsonb_accessor/macro.rb
CHANGED
@@ -66,7 +66,9 @@ module JsonbAccessor
|
|
66
66
|
define_method("#{name}=") do |value|
|
67
67
|
super(value)
|
68
68
|
|
69
|
-
|
69
|
+
# If enum was defined, take the value from the enum and not what comes out directly from the getter
|
70
|
+
attribute_value = defined_enums[name].present? ? defined_enums[name][value] : public_send(name)
|
71
|
+
|
70
72
|
# Rails always saves time based on `default_timezone`. Since #as_json considers timezone, manual conversion is needed
|
71
73
|
if attribute_value.acts_like?(:time)
|
72
74
|
attribute_value = (JsonbAccessor::Helpers.active_record_default_timezone == :utc ? attribute_value.utc : attribute_value.in_time_zone).strftime("%F %R:%S.%L")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonb_accessor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Crismali
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2023-05-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|
@@ -225,6 +225,8 @@ files:
|
|
225
225
|
- docker-compose.yml
|
226
226
|
- gemfiles/activerecord_5.0.0.gemfile
|
227
227
|
- gemfiles/activerecord_5.1.0.gemfile
|
228
|
+
- gemfiles/activerecord_5.2.0.gemfile
|
229
|
+
- gemfiles/activerecord_6.0.0.gemfile
|
228
230
|
- gemfiles/activerecord_6.1.0.gemfile
|
229
231
|
- gemfiles/activerecord_7.0.1.gemfile
|
230
232
|
- jsonb_accessor.gemspec
|
@@ -254,7 +256,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
254
256
|
- !ruby/object:Gem::Version
|
255
257
|
version: '0'
|
256
258
|
requirements: []
|
257
|
-
rubygems_version: 3.
|
259
|
+
rubygems_version: 3.4.6
|
258
260
|
signing_key:
|
259
261
|
specification_version: 4
|
260
262
|
summary: Adds typed jsonb backed fields to your ActiveRecord models.
|