active_model_serializers 0.9.12 → 0.9.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/lib/active_model/serializer/version.rb +1 -1
- data/lib/active_model/serializer.rb +15 -3
- data/test/tmp/app/serializers/account_serializer.rb +1 -2
- metadata +2 -12
- data/test/tmp/app/assets/javascripts/accounts.js +0 -2
- data/test/tmp/app/assets/stylesheets/accounts.css +0 -4
- data/test/tmp/app/controllers/accounts_controller.rb +0 -3
- data/test/tmp/app/helpers/accounts_helper.rb +0 -3
- data/test/tmp/config/routes.rb +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8649ea9bfdefabb0215cc90a6a47a87d902573ecd0e2c73b6142c9cefe17825
|
4
|
+
data.tar.gz: 420e8afdc1ba7cbaaab42d7f8f36c3e10b702587cc7484e270428ded2eeccbdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 237f372c6dd5e73cb7d5f944d90918a23e6acf0f7aa137f0e2972a275445a549a6cf4ffd9e410386c611e89e1dc0137d5451c6d61702d6c6381e43a41e3434ac
|
7
|
+
data.tar.gz: 5d009500e9e616e7d1a7f83adaf7874022f1f039594983e923ef82d4b8f6b8f6268259404b097545a27512b149ec22c8e113a8c0bb51effbef3c0fdd728d7973
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
## 0.09.x
|
2
2
|
|
3
|
-
### [0-9-stable](https://github.com/rails-api/active_model_serializers/compare/v0.9.
|
3
|
+
### [0-9-stable](https://github.com/rails-api/active_model_serializers/compare/v0.9.13...0-9-stable)
|
4
|
+
|
5
|
+
### [v0.9.13 (2024-09-17)](https://github.com/rails-api/active_model_serializers/compare/v0.9.12...v0.9.13)
|
6
|
+
|
7
|
+
- Perf
|
8
|
+
- [#2471](https://github.com/rails-api/active_model_serializers/pull/2471) Generate better attribute accessors, that also don't trigger warnings when redefined. (@byroot)
|
4
9
|
|
5
10
|
### [v0.9.12 (2024-04-11)](https://github.com/rails-api/active_model_serializers/compare/v0.9.11...v0.9.12)
|
6
11
|
|
@@ -90,15 +90,27 @@ end
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def attributes(*attrs)
|
93
|
+
# Use `class_eval` rather than `define_method` for faster access
|
94
|
+
# and avoid retaining objects in the closure.
|
95
|
+
# Batch all methods in a single `class_eval` for efficiceny,
|
96
|
+
# and define all methods on the same line so the eventual backtrace
|
97
|
+
# properly maps to the `attributes` call.
|
98
|
+
source = ["# frozen_string_literal: true\n"]
|
93
99
|
attrs.each do |attr|
|
94
100
|
striped_attr = strip_attribute attr
|
95
101
|
|
96
102
|
@_attributes << striped_attr
|
97
103
|
|
98
|
-
|
99
|
-
|
100
|
-
|
104
|
+
unless method_defined?(attr)
|
105
|
+
source <<
|
106
|
+
"def #{striped_attr}" <<
|
107
|
+
"object.read_attribute_for_serialization(#{attr.inspect})" <<
|
108
|
+
"end" <<
|
109
|
+
"alias_method :#{striped_attr}, :#{striped_attr}" # suppress method redefinition warning
|
110
|
+
end
|
101
111
|
end
|
112
|
+
caller = caller_locations(1, 1).first
|
113
|
+
class_eval(source.join(";"), caller.path, caller.lineno - 1)
|
102
114
|
end
|
103
115
|
|
104
116
|
def has_one(*attrs)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_model_serializers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- José Valim
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-
|
13
|
+
date: 2024-09-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activemodel
|
@@ -115,12 +115,7 @@ files:
|
|
115
115
|
- test/integration/generators/serializer_generator_test.rb
|
116
116
|
- test/test_app.rb
|
117
117
|
- test/test_helper.rb
|
118
|
-
- test/tmp/app/assets/javascripts/accounts.js
|
119
|
-
- test/tmp/app/assets/stylesheets/accounts.css
|
120
|
-
- test/tmp/app/controllers/accounts_controller.rb
|
121
|
-
- test/tmp/app/helpers/accounts_helper.rb
|
122
118
|
- test/tmp/app/serializers/account_serializer.rb
|
123
|
-
- test/tmp/config/routes.rb
|
124
119
|
- test/unit/active_model/array_serializer/except_test.rb
|
125
120
|
- test/unit/active_model/array_serializer/key_format_test.rb
|
126
121
|
- test/unit/active_model/array_serializer/meta_test.rb
|
@@ -198,12 +193,7 @@ test_files:
|
|
198
193
|
- test/integration/generators/serializer_generator_test.rb
|
199
194
|
- test/test_app.rb
|
200
195
|
- test/test_helper.rb
|
201
|
-
- test/tmp/app/assets/javascripts/accounts.js
|
202
|
-
- test/tmp/app/assets/stylesheets/accounts.css
|
203
|
-
- test/tmp/app/controllers/accounts_controller.rb
|
204
|
-
- test/tmp/app/helpers/accounts_helper.rb
|
205
196
|
- test/tmp/app/serializers/account_serializer.rb
|
206
|
-
- test/tmp/config/routes.rb
|
207
197
|
- test/unit/active_model/array_serializer/except_test.rb
|
208
198
|
- test/unit/active_model/array_serializer/key_format_test.rb
|
209
199
|
- test/unit/active_model/array_serializer/meta_test.rb
|
data/test/tmp/config/routes.rb
DELETED