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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 14d3fd3a7bdf72b5aa371e64a7e7b9d493b808734a8b00d775acaf86d1e3b559
4
- data.tar.gz: cddb984181ac63722748a9196f6f5b9cee6c4102afe8da78ab03ba14732e68b0
3
+ metadata.gz: 193184e7a6c008dc18745e187bbf375a9c42a6568d0730ed39dcea3c04888115
4
+ data.tar.gz: e574c34963493d24af6039f534f4074e398d0515f30d6d4ae716c0e8ffbbad33
5
5
  SHA512:
6
- metadata.gz: b66d065bce918b1ae112a5338188f314f7c419549ee25b385eb343f436a3d1a623397986f76a642c276109048d40f4b7957623b28ff421addcbe1336218dceec
7
- data.tar.gz: '08a8226f13ad37cef36113bdeb373b4ba76b7b44881726feccfcbcacdeddc5651b58e5fcd0709c358cbdf3fc54922844b9d561cfbfe1cd62f32d232c171cc611'
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bright_serializer (0.3.0)
4
+ bright_serializer (0.3.1)
5
5
  oj (~> 3)
6
6
 
7
7
  GEM
@@ -89,4 +89,4 @@ DEPENDENCIES
89
89
  rubocop-rspec
90
90
 
91
91
  BUNDLED WITH
92
- 2.1.4
92
+ 2.2.3
@@ -20,12 +20,14 @@ module BrightSerializer
20
20
  def initialize(object, **options)
21
21
  @object = object
22
22
  @params = options.delete(:params)
23
- @fields = Set.new(options.delete(:fields))
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 @fields.any? && !@fields.include?(attribute.key)
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BrightSerializer
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  end
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.0
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-05-26 00:00:00.000000000 Z
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.1.2
130
+ rubygems_version: 3.0.3
131
131
  signing_key:
132
132
  specification_version: 4
133
133
  summary: Light and fast Ruby serializer