active_decorator 1.3.4 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +25 -20
- data/CHANGELOG.md +4 -0
- data/README.md +2 -2
- data/gemfiles/Gemfile-rails.6.1.x +1 -0
- data/lib/active_decorator/decorator.rb +23 -19
- data/lib/active_decorator/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: f803e15d40a85700faf6ceb443bea2fabc225c2d3503e32c99dcb4e54e7f75e3
|
4
|
+
data.tar.gz: 1c15042cec49c02013f05ff50c91335d00d6acff63b6ae51ccee2ea77c27ec88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b48a0acdcdce16cd8f3fda7b56c95209af5e833502ea2ea5f9244e9e78bcf4255c376c21f50310631852a928279283d070bed45f618578867eb1edd45f6ddcaa
|
7
|
+
data.tar.gz: 8b959e33b9c70791a47ee759a6e9c3c877672cda9bb3ba5dc1de0ea4587be5d16bbccd0d0e980fc9ecfaae47adad0f616b35dda7f3c902b05cba064fda21fcc5
|
data/.travis.yml
CHANGED
@@ -11,9 +11,9 @@ before_install:
|
|
11
11
|
cache: bundler
|
12
12
|
|
13
13
|
# rvm:
|
14
|
-
# - 2.6.
|
15
|
-
# - 2.5.
|
16
|
-
# - 2.4.
|
14
|
+
# - 2.6.7
|
15
|
+
# - 2.5.9
|
16
|
+
# - 2.4.10
|
17
17
|
# - 2.3.8
|
18
18
|
# - 2.2.10
|
19
19
|
# - 2.1.10
|
@@ -26,47 +26,53 @@ cache: bundler
|
|
26
26
|
|
27
27
|
matrix:
|
28
28
|
include:
|
29
|
-
- rvm:
|
29
|
+
- rvm: 3.0.1
|
30
30
|
gemfile: gemfiles/Gemfile-rails.6.1.x
|
31
|
-
- rvm:
|
31
|
+
- rvm: 3.0.1
|
32
32
|
gemfile: gemfiles/Gemfile-rails.6.1.x
|
33
33
|
env: API=1
|
34
|
-
|
34
|
+
|
35
|
+
- rvm: 2.7.3
|
36
|
+
gemfile: gemfiles/Gemfile-rails.6.1.x
|
37
|
+
- rvm: 2.7.3
|
38
|
+
gemfile: gemfiles/Gemfile-rails.6.1.x
|
39
|
+
env: API=1
|
40
|
+
- rvm: 2.7.3
|
35
41
|
gemfile: gemfiles/Gemfile-rails.6.0.x
|
36
|
-
- rvm: 2.7.
|
42
|
+
- rvm: 2.7.3
|
37
43
|
gemfile: gemfiles/Gemfile-rails.6.0.x
|
38
44
|
env: API=1
|
39
45
|
|
40
|
-
- rvm: 2.6.
|
46
|
+
- rvm: 2.6.7
|
41
47
|
gemfile: gemfiles/Gemfile-rails.6.1.x
|
42
|
-
- rvm: 2.6.
|
48
|
+
- rvm: 2.6.7
|
43
49
|
gemfile: gemfiles/Gemfile-rails.6.1.x
|
44
50
|
env: API=1
|
45
|
-
- rvm: 2.6.
|
51
|
+
- rvm: 2.6.7
|
46
52
|
gemfile: gemfiles/Gemfile-rails.6.0.x
|
47
|
-
- rvm: 2.6.
|
53
|
+
- rvm: 2.6.7
|
48
54
|
gemfile: gemfiles/Gemfile-rails.6.0.x
|
49
55
|
env: API=1
|
50
|
-
- rvm: 2.6.
|
56
|
+
- rvm: 2.6.7
|
51
57
|
gemfile: gemfiles/Gemfile-rails.5.2.x
|
52
|
-
- rvm: 2.6.
|
58
|
+
- rvm: 2.6.7
|
53
59
|
gemfile: gemfiles/Gemfile-rails.5.2.x
|
54
60
|
env: API=1
|
55
|
-
- rvm: 2.6.
|
61
|
+
- rvm: 2.6.7
|
56
62
|
gemfile: gemfiles/Gemfile-rails.5.1.x
|
57
|
-
- rvm: 2.6.
|
63
|
+
- rvm: 2.6.7
|
58
64
|
gemfile: gemfiles/Gemfile-rails.5.1.x
|
59
65
|
env: API=1
|
60
|
-
- rvm: 2.6.
|
66
|
+
- rvm: 2.6.7
|
61
67
|
gemfile: gemfiles/Gemfile-rails.5.0.x
|
62
|
-
- rvm: 2.6.
|
68
|
+
- rvm: 2.6.7
|
63
69
|
gemfile: gemfiles/Gemfile-rails.5.0.x
|
64
70
|
env: API=1
|
65
71
|
|
66
|
-
- rvm: 2.5.
|
72
|
+
- rvm: 2.5.9
|
67
73
|
gemfile: gemfiles/Gemfile-rails.5.2.x
|
68
74
|
|
69
|
-
- rvm: 2.4.
|
75
|
+
- rvm: 2.4.10
|
70
76
|
gemfile: gemfiles/Gemfile-rails.5.2.x
|
71
77
|
|
72
78
|
- rvm: 2.3.8
|
@@ -85,7 +91,6 @@ matrix:
|
|
85
91
|
|
86
92
|
- rvm: ruby-head
|
87
93
|
gemfile: gemfiles/Gemfile-rails.edge
|
88
|
-
|
89
94
|
- rvm: ruby-head
|
90
95
|
gemfile: gemfiles/Gemfile-rails.edge
|
91
96
|
env: API=1
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -15,9 +15,9 @@ A simple and Rubyish view helper for Rails 4, Rails 5, and Rails 6. Keep your he
|
|
15
15
|
|
16
16
|
## Supported versions ##
|
17
17
|
|
18
|
-
* Ruby 2.0.0, 2.1.x, 2.2.x, 2.3.x, 2.4.x, 2.5.x, 2.6.x,
|
18
|
+
* Ruby 2.0.0, 2.1.x, 2.2.x, 2.3.x, 2.4.x, 2.5.x, 2.6.x, 2.7.x, 3.0.x, and 3.1 (trunk)
|
19
19
|
|
20
|
-
* Rails 4.2.x, 5.0, 5.1, 5.2, 6.0,
|
20
|
+
* Rails 4.2.x, 5.0, 5.1, 5.2, 6.0, 6.1, and 7.0 (edge)
|
21
21
|
|
22
22
|
|
23
23
|
## Supported ORMs ##
|
@@ -23,34 +23,38 @@ module ActiveDecorator
|
|
23
23
|
#
|
24
24
|
# This method can be publicly called from anywhere by `ActiveDecorator::Decorator.instance.decorate(obj)`.
|
25
25
|
def decorate(obj)
|
26
|
-
return if defined?(Jbuilder) && (Jbuilder === obj)
|
27
|
-
return if obj.nil?
|
26
|
+
return obj if defined?(Jbuilder) && (Jbuilder === obj)
|
28
27
|
|
29
|
-
|
28
|
+
case obj
|
29
|
+
when Array
|
30
30
|
obj.each do |r|
|
31
31
|
decorate r
|
32
32
|
end
|
33
|
-
|
33
|
+
when Hash
|
34
34
|
obj.each_value do |v|
|
35
35
|
decorate v
|
36
36
|
end
|
37
|
-
|
38
|
-
|
39
|
-
if obj.respond_to?(:records)
|
40
|
-
# Rails 5.0
|
41
|
-
obj.extend ActiveDecorator::RelationDecorator unless obj.is_a? ActiveDecorator::RelationDecorator
|
42
|
-
else
|
43
|
-
# Rails 3.x and 4.x
|
44
|
-
obj.extend ActiveDecorator::RelationDecoratorLegacy unless obj.is_a? ActiveDecorator::RelationDecoratorLegacy
|
45
|
-
end
|
37
|
+
when nil, true, false
|
38
|
+
obj
|
46
39
|
else
|
47
|
-
if defined?(ActiveRecord) && obj.is_a?(ActiveRecord::
|
48
|
-
|
49
|
-
|
40
|
+
if defined?(ActiveRecord) && obj.is_a?(ActiveRecord::Relation)
|
41
|
+
# don't call each nor to_a immediately
|
42
|
+
if obj.respond_to?(:records)
|
43
|
+
# Rails 5.0
|
44
|
+
obj.extend ActiveDecorator::RelationDecorator unless obj.is_a? ActiveDecorator::RelationDecorator
|
45
|
+
else
|
46
|
+
# Rails 3.x and 4.x
|
47
|
+
obj.extend ActiveDecorator::RelationDecoratorLegacy unless obj.is_a? ActiveDecorator::RelationDecoratorLegacy
|
48
|
+
end
|
49
|
+
else
|
50
|
+
if defined?(ActiveRecord) && obj.is_a?(ActiveRecord::Base) && !obj.is_a?(ActiveDecorator::Decorated)
|
51
|
+
obj.extend ActiveDecorator::Decorated
|
52
|
+
end
|
50
53
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
+
d = decorator_for obj.class
|
55
|
+
return obj unless d
|
56
|
+
obj.extend d unless obj.is_a? d
|
57
|
+
end
|
54
58
|
end
|
55
59
|
|
56
60
|
obj
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_decorator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akira Matsuda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -184,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
184
|
- !ruby/object:Gem::Version
|
185
185
|
version: '0'
|
186
186
|
requirements: []
|
187
|
-
rubygems_version: 3.
|
187
|
+
rubygems_version: 3.3.0.dev
|
188
188
|
signing_key:
|
189
189
|
specification_version: 4
|
190
190
|
summary: A simple and Rubyish view helper for Rails
|