bright_serializer 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +2 -2
- data/lib/bright_serializer/serializer.rb +4 -2
- data/lib/bright_serializer/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: 193184e7a6c008dc18745e187bbf375a9c42a6568d0730ed39dcea3c04888115
|
4
|
+
data.tar.gz: e574c34963493d24af6039f534f4074e398d0515f30d6d4ae716c0e8ffbbad33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4271988147d4f68f39a1846d7cbcbdba6cbc445e2ee28c58160f8a124658cd6cebd4bebf5e0c5e4f56c811229ccb295c44e914ddeaba4c0289fe232c12cf0b59
|
7
|
+
data.tar.gz: ee98dfaf4e70a123bfe5ea46dc0817e0beaefb93238f21ed856da0eb5e722a864c9bc42256611ec81bdd6722d3f751afb9e1b8d1a42b8219c7a77c3fbabe1180
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
## master (unreleased)
|
4
4
|
|
5
|
+
## 0.3.1 (2022-09-28)
|
6
|
+
|
7
|
+
* Performance improvements, use nil instead of empty set. ([#97](https://github.com/petalmd/bright_serializer/pull/97))
|
8
|
+
* Move specs out of lib. ([#96](https://github.com/petalmd/bright_serializer/pull/96))
|
9
|
+
|
5
10
|
## 0.3.0 (2022-05-26)
|
6
11
|
|
7
12
|
* Allow to evaluate entity values with a callable lambda. ([#88](https://github.com/petalmd/bright_serializer/pull/88))
|
data/Gemfile.lock
CHANGED
@@ -20,12 +20,14 @@ module BrightSerializer
|
|
20
20
|
def initialize(object, **options)
|
21
21
|
@object = object
|
22
22
|
@params = options.delete(:params)
|
23
|
-
|
23
|
+
|
24
|
+
fields = options.delete(:fields)
|
25
|
+
@fields = fields ? Set.new(fields) : nil
|
24
26
|
end
|
25
27
|
|
26
28
|
def serialize(object)
|
27
29
|
self.class.attributes_to_serialize.each_with_object({}) do |attribute, result|
|
28
|
-
next if
|
30
|
+
next if !@fields.nil? && !@fields.include?(attribute.key)
|
29
31
|
next unless attribute.condition?(object, @params)
|
30
32
|
|
31
33
|
result[attribute.transformed_key] = attribute.serialize(self, object, @params)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bright_serializer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean-Francis Bastien
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
127
|
- !ruby/object:Gem::Version
|
128
128
|
version: '0'
|
129
129
|
requirements: []
|
130
|
-
rubygems_version: 3.
|
130
|
+
rubygems_version: 3.0.3
|
131
131
|
signing_key:
|
132
132
|
specification_version: 4
|
133
133
|
summary: Light and fast Ruby serializer
|