jsonb_accessor 1.3.7 → 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 +2 -3
- data/.rubocop.yml +2 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +5 -0
- data/README.md +6 -0
- data/docker-compose.yml +1 -1
- data/lib/jsonb_accessor/macro.rb +3 -1
- data/lib/jsonb_accessor/version.rb +1 -1
- metadata +3 -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
|
@@ -131,7 +130,7 @@ jobs:
|
|
131
130
|
name: ${{ matrix.gemfile }}, ruby ${{ matrix.ruby }}
|
132
131
|
|
133
132
|
steps:
|
134
|
-
- uses: actions/checkout@
|
133
|
+
- uses: actions/checkout@v3
|
135
134
|
|
136
135
|
- name: Set up Ruby
|
137
136
|
uses: ruby/setup-ruby@v1
|
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
3.2.1
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,11 @@
|
|
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
|
+
|
4
9
|
## [1.3.7] - 2022-12-29
|
5
10
|
|
6
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)
|
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/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
|
@@ -256,7 +256,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
256
256
|
- !ruby/object:Gem::Version
|
257
257
|
version: '0'
|
258
258
|
requirements: []
|
259
|
-
rubygems_version: 3.
|
259
|
+
rubygems_version: 3.4.6
|
260
260
|
signing_key:
|
261
261
|
specification_version: 4
|
262
262
|
summary: Adds typed jsonb backed fields to your ActiveRecord models.
|