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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: abd22d415613228c6c98fe9a0bf7255496dabaada709c34ba2cbe032a2fcc9b6
4
- data.tar.gz: af38045be9a3de1832be692fa8f349010e7f79c7144d8d1f9f248aa3c311abb3
3
+ metadata.gz: f803e15d40a85700faf6ceb443bea2fabc225c2d3503e32c99dcb4e54e7f75e3
4
+ data.tar.gz: 1c15042cec49c02013f05ff50c91335d00d6acff63b6ae51ccee2ea77c27ec88
5
5
  SHA512:
6
- metadata.gz: 39f6198f7583dbc4df7bb3071161f234ce858cda7d17a27c07caab910bc3a1c652468cd42dfd7bf094cb53ceedc9da8c9a35d031a0e258398dc41f15b44d2925
7
- data.tar.gz: 3b342f062765a460b03b3adbe2562cf01579a4b54427713dd3abe88694e371acee44ded648a218e9a2fd2872285635a08016cf11a0b68ecae0631243c6909c2f
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.6
15
- # - 2.5.8
16
- # - 2.4.6
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: 2.7.1
29
+ - rvm: 3.0.1
30
30
  gemfile: gemfiles/Gemfile-rails.6.1.x
31
- - rvm: 2.7.1
31
+ - rvm: 3.0.1
32
32
  gemfile: gemfiles/Gemfile-rails.6.1.x
33
33
  env: API=1
34
- - rvm: 2.7.1
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.1
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.6
46
+ - rvm: 2.6.7
41
47
  gemfile: gemfiles/Gemfile-rails.6.1.x
42
- - rvm: 2.6.6
48
+ - rvm: 2.6.7
43
49
  gemfile: gemfiles/Gemfile-rails.6.1.x
44
50
  env: API=1
45
- - rvm: 2.6.6
51
+ - rvm: 2.6.7
46
52
  gemfile: gemfiles/Gemfile-rails.6.0.x
47
- - rvm: 2.6.6
53
+ - rvm: 2.6.7
48
54
  gemfile: gemfiles/Gemfile-rails.6.0.x
49
55
  env: API=1
50
- - rvm: 2.6.6
56
+ - rvm: 2.6.7
51
57
  gemfile: gemfiles/Gemfile-rails.5.2.x
52
- - rvm: 2.6.6
58
+ - rvm: 2.6.7
53
59
  gemfile: gemfiles/Gemfile-rails.5.2.x
54
60
  env: API=1
55
- - rvm: 2.6.6
61
+ - rvm: 2.6.7
56
62
  gemfile: gemfiles/Gemfile-rails.5.1.x
57
- - rvm: 2.6.6
63
+ - rvm: 2.6.7
58
64
  gemfile: gemfiles/Gemfile-rails.5.1.x
59
65
  env: API=1
60
- - rvm: 2.6.6
66
+ - rvm: 2.6.7
61
67
  gemfile: gemfiles/Gemfile-rails.5.0.x
62
- - rvm: 2.6.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.8
72
+ - rvm: 2.5.9
67
73
  gemfile: gemfiles/Gemfile-rails.5.2.x
68
74
 
69
- - rvm: 2.4.6
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
@@ -1,3 +1,7 @@
1
+ ## 1.4.0
2
+
3
+ * Decorate non-nil objects where `nil?` returns true, namely, ActionText::RichText body [@jamesbrooks]
4
+
1
5
  ## 1.3.4
2
6
 
3
7
  * Support Rails 6.1 [@y-yagi]
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, and 2.7 (trunk)
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, and 6.1 (edge)
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 ##
@@ -4,4 +4,5 @@ gemspec path: '..'
4
4
 
5
5
  gem 'rails', '~> 6.1.0'
6
6
  gem 'webdrivers'
7
+ gem 'rexml'
7
8
  gem 'jbuilder' unless ENV['API']
@@ -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
- if obj.is_a?(Array)
28
+ case obj
29
+ when Array
30
30
  obj.each do |r|
31
31
  decorate r
32
32
  end
33
- elsif obj.is_a?(Hash)
33
+ when Hash
34
34
  obj.each_value do |v|
35
35
  decorate v
36
36
  end
37
- elsif defined?(ActiveRecord) && obj.is_a?(ActiveRecord::Relation)
38
- # don't call each nor to_a immediately
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::Base) && !obj.is_a?(ActiveDecorator::Decorated)
48
- obj.extend ActiveDecorator::Decorated
49
- end
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
- d = decorator_for obj.class
52
- return obj unless d
53
- obj.extend d unless obj.is_a? d
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveDecorator
4
- VERSION = '1.3.4'
4
+ VERSION = '1.4.0'
5
5
  end
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.3.4
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: 2020-12-21 00:00:00.000000000 Z
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.2.0
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