bright_serializer 0.2.1 → 0.2.2

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: be9127288c21561c1c2b6e39d8e4e3620cbf5ffae9e416f6bc2716ad3db82aa5
4
- data.tar.gz: 51e625f2f892ef31288821286fc029bba2bb3a5df26c7d8753481c58e4f3b47c
3
+ metadata.gz: dc92e0a791c3939a0eeb7b4b6ca33bf322a8e0746cc7711da7749a74cc6b00e2
4
+ data.tar.gz: a5b247fb91b5bb4cf0e150fe7eb290c834658de4884e611ff85a05ddd5a19c7b
5
5
  SHA512:
6
- metadata.gz: 8ade52adac1afbc0f25a00364db7b8477bf69afeb0636874e2104dbc385a48e7b28a6a7e2e56ac3958794634edf12bbd00af6ff1ac390f384cbe59c6a05dc6d5
7
- data.tar.gz: 8f4867b850363eb2022d231e78caf10827c0ada7f7972830984980bfb75cde62db9a4484945a2047c692fa3c429f57be3d6a73e9f05ffea8af390f3ad0ff6b9e
6
+ metadata.gz: 2dc0f756681d3b650cc8156b6667949e543dac716b9c5f55114f4303024106da4355f5daa56200a94d04ee6e4a16559f9fa519b30231e462097ff8b6a1cdfc71
7
+ data.tar.gz: 6bcf8c18f406dc4291b7c6eccc038351c353ea4ddc5b1015424527ebbf08203f943cdd7f6d5d24dcbe9b065737844ff78d34a26bb98db9151fb0866ee1dbce0e
@@ -3,21 +3,35 @@ name: Build
3
3
  on: [push]
4
4
 
5
5
  jobs:
6
- build:
6
+ Build:
7
7
 
8
8
  runs-on: ubuntu-latest
9
-
9
+ strategy:
10
+ matrix:
11
+ ruby: [2.5, 2.6, 2.7]
10
12
  steps:
11
13
  - uses: actions/checkout@v1
12
- - name: Set up Ruby 2.7
14
+ - name: Set up Ruby ${{ matrix.ruby }}
13
15
  uses: actions/setup-ruby@v1
14
16
  with:
15
- ruby-version: 2.7
17
+ ruby-version: ${{ matrix.ruby }}
16
18
  - name: Bundle install
17
19
  run: |
18
20
  gem install bundler
19
21
  bundle install --jobs 4 --retry 3
20
22
  - name: Specs
21
23
  run: bundle exec rake
22
- - name: Rubocop
23
- run: bundle exec rubocop --parallel
24
+ Rubocop:
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - uses: actions/checkout@v1
28
+ - name: Set up Ruby 2.7
29
+ uses: actions/setup-ruby@v1
30
+ with:
31
+ ruby-version: 2.7
32
+ - name: Bundle install
33
+ run: |
34
+ gem install bundler
35
+ bundle install --jobs 4 --retry 3
36
+ - name: Rubocop
37
+ run: bundle exec rubocop --parallel
@@ -2,6 +2,9 @@ require:
2
2
  - rubocop-performance
3
3
  - rubocop-rspec
4
4
 
5
+ AllCops:
6
+ NewCops: enable
7
+
5
8
  Metrics/BlockLength:
6
9
  Enabled: false
7
10
 
@@ -4,6 +4,12 @@
4
4
 
5
5
  * Your contribution
6
6
 
7
+ ## 0.2.2 (2020-07-22)
8
+
9
+ * Run CI build on all supported Ruby versions (#11)
10
+ * Update Rubocop 0.78.0 => 0.88.0 and run auto-correction
11
+ * Deep transform entity keys (#12)
12
+
7
13
  ## 0.2.1 (2020-07-21)
8
14
 
9
15
  * Handle set_key_transform inherited from a parent serializer (#10)
@@ -1,26 +1,27 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bright_serializer (0.2.1)
4
+ bright_serializer (0.2.2)
5
5
  oj (~> 3)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- ast (2.4.0)
10
+ ast (2.4.1)
11
11
  concurrent-ruby (1.1.5)
12
12
  diff-lcs (1.4.4)
13
13
  faker (2.9.0)
14
14
  i18n (>= 1.6, < 1.8)
15
15
  i18n (1.7.0)
16
16
  concurrent-ruby (~> 1.0)
17
- jaro_winkler (1.5.4)
18
17
  oj (3.10.0)
19
- parallel (1.19.1)
20
- parser (2.7.0.0)
21
- ast (~> 2.4.0)
18
+ parallel (1.19.2)
19
+ parser (2.7.1.4)
20
+ ast (~> 2.4.1)
22
21
  rainbow (3.0.0)
23
22
  rake (13.0.1)
23
+ regexp_parser (1.7.1)
24
+ rexml (3.2.4)
24
25
  rspec (3.9.0)
25
26
  rspec-core (~> 3.9.0)
26
27
  rspec-expectations (~> 3.9.0)
@@ -34,19 +35,23 @@ GEM
34
35
  diff-lcs (>= 1.2.0, < 2.0)
35
36
  rspec-support (~> 3.9.0)
36
37
  rspec-support (3.9.3)
37
- rubocop (0.78.0)
38
- jaro_winkler (~> 1.5.1)
38
+ rubocop (0.88.0)
39
39
  parallel (~> 1.10)
40
- parser (>= 2.6)
40
+ parser (>= 2.7.1.1)
41
41
  rainbow (>= 2.2.2, < 4.0)
42
+ regexp_parser (>= 1.7)
43
+ rexml
44
+ rubocop-ast (>= 0.1.0, < 1.0)
42
45
  ruby-progressbar (~> 1.7)
43
- unicode-display_width (>= 1.4.0, < 1.7)
46
+ unicode-display_width (>= 1.4.0, < 2.0)
47
+ rubocop-ast (0.2.0)
48
+ parser (>= 2.7.0.1)
44
49
  rubocop-performance (1.5.2)
45
50
  rubocop (>= 0.71.0)
46
51
  rubocop-rspec (1.37.1)
47
52
  rubocop (>= 0.68.1)
48
53
  ruby-progressbar (1.10.1)
49
- unicode-display_width (1.6.0)
54
+ unicode-display_width (1.7.0)
50
55
 
51
56
  PLATFORMS
52
57
  ruby
@@ -14,7 +14,7 @@ module BrightSerializer
14
14
  end
15
15
 
16
16
  def to_h
17
- @definition.transform_keys! { |k| Inflector.camel_lower k.to_s }
17
+ Inflector.deep_transform_keys_in_object!(@definition) { |k| Inflector.camel_lower k.to_s }
18
18
  parse_ref!
19
19
  @definition
20
20
  end
@@ -3,8 +3,7 @@
3
3
  module BrightSerializer
4
4
  module Entity
5
5
  class Parser
6
- attr_reader :model
7
- attr_reader :endpoint
6
+ attr_reader :model, :endpoint
8
7
 
9
8
  def initialize(model, endpoint)
10
9
  @model = model
@@ -59,5 +59,21 @@ class Inflector
59
59
  end
60
60
  end
61
61
  end
62
+
63
+ # File active_support/core_ext/hash/keys.rb, line 156
64
+ def deep_transform_keys_in_object!(object, &block)
65
+ case object
66
+ when Hash
67
+ object.keys.each do |key| # rubocop:disable Style/HashEachMethods
68
+ value = object.delete(key)
69
+ object[yield(key)] = deep_transform_keys_in_object!(value, &block)
70
+ end
71
+ object
72
+ when Array
73
+ object.map! { |e| deep_transform_keys_in_object!(e, &block) }
74
+ else
75
+ object
76
+ end
77
+ end
62
78
  end
63
79
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BrightSerializer
4
- VERSION = '0.2.1'
4
+ VERSION = '0.2.2'
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.2.1
4
+ version: 0.2.2
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: 2020-07-21 00:00:00.000000000 Z
11
+ date: 2020-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj