userializer 0.1.5 → 0.1.6

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: 97fa2e63cfd59d981e9a7f8eac172e31830d53ad572aaab8683e62fa26410d27
4
- data.tar.gz: 1a6c4b3947dcbe65c7b915ef3f5538e68f0b35805860cd5eb2fe03d01e9b7299
3
+ metadata.gz: 2ff7b3083a1f53deccff3139fc8625c9ac17a313f07fd2f0b98ca912a8ef6d46
4
+ data.tar.gz: cf90d14d354b5dbcbd6bb1e9021860583b57adf2ff10bc599a8aa15e3c33531d
5
5
  SHA512:
6
- metadata.gz: 1f58f0270860f307e07c2d80a8ee620e338e75db06316e1fedd0f7f916c1cafa96122363b5ff7c775cdc2376483718ca07aa84264a284546d4f9bc72c1e373ab
7
- data.tar.gz: '0539527fde035a912a6c97dc1e25d83a49e2a1ada7a30ee9df93f890e7e9d5b76e7b120f88704a2b37f2b9dbaa9c170c4229aeb33f602bb4d4a104c9b4419e7c'
6
+ metadata.gz: 140ffbbe09cd46455c97fcc5e9d36b6adb9f7cca28b21b0c4231f316d887125fd131b0e8046e49c3bea1c1a6719ba3e99c8bb143d5e2d127a5e7ef6843e659c2
7
+ data.tar.gz: fc5b3c983c81bedd8807c38a41a0bf323ad5597eaacbfa4c64a618744c092bf9e252f6129dc88fb0c5c2c5f1715bee6271b6e8cbf21f86eb0d8889ca53624aed
@@ -0,0 +1,18 @@
1
+ version: 2
2
+ jobs:
3
+ run_tests:
4
+ docker:
5
+ - image: circleci/ruby:2.4.1
6
+
7
+ working_directory: ~/userializer
8
+
9
+ steps:
10
+ - checkout
11
+ - run: bundle install --path=vendor/bundle
12
+ - run: bundle exec rspec --color --require spec_helper --format progress spec
13
+
14
+ workflows:
15
+ version: 2
16
+ test:
17
+ jobs:
18
+ - run_tests
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- userializer (0.1.5)
4
+ userializer (0.1.6)
5
5
  activesupport
6
6
  oj
7
7
 
@@ -47,4 +47,4 @@ DEPENDENCIES
47
47
  userializer!
48
48
 
49
49
  BUNDLED WITH
50
- 1.16.1
50
+ 1.16.2
@@ -15,17 +15,24 @@ module USerializer
15
15
  def merge_attributes(res, ser, opts)
16
16
  return unless @conditional_block.call(ser.object, opts)
17
17
 
18
- res[@id_key] = (ser.send(@key) || []).compact.map do |obj|
18
+ res[@id_key] = (entities(ser) || []).compact.map do |obj|
19
19
  obj.nil? ? nil : obj.send(@embed_key)
20
20
  end.compact
21
21
  end
22
22
 
23
23
  def merge_root(res, ser, opts)
24
- objs = ser.send(@key) || []
24
+ objs = entities(ser) || []
25
25
 
26
26
  return if objs.empty? || !@conditional_block.call(ser.object, opts)
27
27
 
28
28
  ArraySerializer.new(objs, @opts).merge_root(res, opts)
29
29
  end
30
+
31
+ def entities(ser)
32
+ obj = ser.send(@key) || []
33
+ return obj unless @opts[:scope]
34
+
35
+ obj.send(@opts[:scope])
36
+ end
30
37
  end
31
38
  end
@@ -1,3 +1,3 @@
1
1
  module USerializer
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: userializer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexis Montagne
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-17 00:00:00.000000000 Z
11
+ date: 2019-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -87,6 +87,7 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
+ - ".circleci/config.yml"
90
91
  - ".gitignore"
91
92
  - ".rspec"
92
93
  - ".travis.yml"
@@ -123,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
124
  version: '0'
124
125
  requirements: []
125
126
  rubyforge_project:
126
- rubygems_version: 2.7.3
127
+ rubygems_version: 3.0.0.beta3
127
128
  signing_key:
128
129
  specification_version: 4
129
130
  summary: Write a short summary, because RubyGems requires one.