active_mappers 1.4.3 → 1.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +10 -8
- data/active_mappers.gemspec +2 -2
- data/lib/active_mappers.rb +8 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d79ff028b7e6d2f46b741374a9ba710f9d5e29b2bdaa5a09dbd561bb77db1ed5
|
4
|
+
data.tar.gz: 2d32b10d4d164961029216dc6e242f95ff8fea2a64f597868107bbdbef4aa02a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d72a097acd2e309cdf830c3b5af1d7af3109c77c0dfb7f93e6c9b10391189f281cc77a57270b8077c61cde835d04cec71284efa5433f0059d9e5f143ddd000f4
|
7
|
+
data.tar.gz: f90b555e71c1214a46ddfa340b1cec14dc210b4adee614e13f8e150064f36eb4ac6a8c161ea96d00e76b7cfc1884a3396e73c79a2bf6b0119c306037c802269a
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
active_mappers (1.4.
|
4
|
+
active_mappers (1.4.4)
|
5
5
|
activesupport (>= 4.2)
|
6
6
|
method_source (~> 0.9.2)
|
7
7
|
mocha (>= 1.8.0)
|
@@ -11,29 +11,31 @@ PATH
|
|
11
11
|
GEM
|
12
12
|
remote: https://rubygems.org/
|
13
13
|
specs:
|
14
|
-
activesupport (
|
14
|
+
activesupport (6.0.1)
|
15
15
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
16
|
i18n (>= 0.7, < 2)
|
17
17
|
minitest (~> 5.1)
|
18
18
|
tzinfo (~> 1.1)
|
19
|
+
zeitwerk (~> 2.2)
|
19
20
|
concurrent-ruby (1.1.5)
|
20
|
-
i18n (1.
|
21
|
+
i18n (1.7.0)
|
21
22
|
concurrent-ruby (~> 1.0)
|
22
23
|
metaclass (0.0.4)
|
23
24
|
method_source (0.9.2)
|
24
|
-
minitest (5.
|
25
|
-
mocha (1.
|
25
|
+
minitest (5.13.0)
|
26
|
+
mocha (1.9.0)
|
26
27
|
metaclass (~> 0.0.1)
|
27
28
|
rake (12.3.1)
|
28
|
-
ruby2ruby (2.4.
|
29
|
+
ruby2ruby (2.4.4)
|
29
30
|
ruby_parser (~> 3.1)
|
30
31
|
sexp_processor (~> 4.6)
|
31
|
-
ruby_parser (3.
|
32
|
+
ruby_parser (3.14.1)
|
32
33
|
sexp_processor (~> 4.9)
|
33
|
-
sexp_processor (4.
|
34
|
+
sexp_processor (4.13.0)
|
34
35
|
thread_safe (0.3.6)
|
35
36
|
tzinfo (1.2.5)
|
36
37
|
thread_safe (~> 0.1)
|
38
|
+
zeitwerk (2.2.1)
|
37
39
|
|
38
40
|
PLATFORMS
|
39
41
|
ruby
|
data/active_mappers.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'active_mappers'
|
3
|
-
s.version = '1.4.
|
4
|
-
s.date = '2019-
|
3
|
+
s.version = '1.4.4'
|
4
|
+
s.date = '2019-11-12'
|
5
5
|
s.summary = 'Slick, fast view layer for you Rails API.'
|
6
6
|
s.description = 'Fast, simple, declarative way to design your API\'s view layer'
|
7
7
|
s.authors = ['Michaël Villeneuve']
|
data/lib/active_mappers.rb
CHANGED
@@ -44,10 +44,14 @@ module ActiveMappers
|
|
44
44
|
def self.relation(key, mapper = nil, **options)
|
45
45
|
path = options[:optional_path] || key
|
46
46
|
each do |resource|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
mapper_to_use = if mapper
|
48
|
+
mapper
|
49
|
+
else
|
50
|
+
relation_class_name = resource.class&.reflect_on_association(options[:optional_path] || key)&.class_name
|
51
|
+
raise "undefined relation : #{key.to_s}" if (mapper.nil? && relation_class_name.nil?)
|
52
|
+
KeyTransformer.resource_class_to_mapper(relation_class_name, self)
|
53
|
+
end
|
54
|
+
|
51
55
|
raise "'#{mapper_to_use.name}' should be a mapper" unless mapper_to_use.ancestors.map(&:to_s).include?("ActiveMappers::Base")
|
52
56
|
|
53
57
|
{ key => mapper_to_use.with(path.to_s.split('.').inject(resource, :try), default_options.merge(options)) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_mappers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michaël Villeneuve
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|