draper 4.0.5 → 4.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 01d36de260431b65888e966e0ae86d336da78fb154c016e3e1871c07db8b1502
4
- data.tar.gz: 773cef0abfa87de807d460dca408a86d1aa9f34e2e652486c6b242c9819ad178
3
+ metadata.gz: c37ab7e42fe93c37a13899d6b51f1dbddfcb7a417eaad7531a3e11d59fb63442
4
+ data.tar.gz: 3ab092943fa340ef28abfe4974960201374f92e2defa6bd1c8fd90cd495b6056
5
5
  SHA512:
6
- metadata.gz: bc3e685a475539225c88e1d7cc44575ec5ce59872ddd1babede55eb9a07c323a2fa267e3d35d55d2c009a12948e83273150c132829597c8bc641c99c15445f7b
7
- data.tar.gz: 37670673d87b1fea1b93bf435756d1ddaee6da897c1f3905c9aaec7c1b7dab6e02cb3ea9c52ab106a98b54c0e254c1f0e2d8fddaab0ba539a8a308b9cbdd58ea
6
+ metadata.gz: d700dbac01e145361e56c8b6fbf04c93b9156492e14659ba6724fa36be20ebdac6319c2bc2910beaf68b9cbe40271808ed17c23bed2c8a76361d438cc5b35033
7
+ data.tar.gz: bd8689b7de4f934d97dc48a564795ef91e2e859b586f7561c0ba3996e0f2b7434a29d8a9e497d5248b0e28074b854befdb86f6f20858f1816474755ec14fdca3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Draper Changelog
2
2
 
3
+ ## 4.0.6 - 2025-11-15
4
+
5
+ ### Fixes
6
+ * Revert breaking change from v4.0.5
7
+
3
8
  ## 4.0.5 - 2025-11-12
4
9
 
5
10
  ### Fixes
@@ -61,6 +61,12 @@ module Draper
61
61
 
62
62
  alias :decorated_with? :instance_of?
63
63
 
64
+ def kind_of?(klass)
65
+ decorated_collection.kind_of?(klass) || super
66
+ end
67
+
68
+ alias_method :is_a?, :kind_of?
69
+
64
70
  def replace(other)
65
71
  decorated_collection.replace(other)
66
72
  self
@@ -33,7 +33,7 @@ module Draper
33
33
  options.assert_valid_keys(:context)
34
34
  @object = object
35
35
  @context = options.fetch(:context, {})
36
- handle_multiple_decoration(options) if object.is_a?(Draper::Decorator)
36
+ handle_multiple_decoration(options) if object.instance_of?(self.class)
37
37
  end
38
38
 
39
39
  class << self
@@ -185,6 +185,22 @@ module Draper
185
185
  self.class.hash ^ object.hash
186
186
  end
187
187
 
188
+ # Checks if `self.kind_of?(klass)` or `object.kind_of?(klass)`
189
+ #
190
+ # @param [Class] klass
191
+ def kind_of?(klass)
192
+ super || object.kind_of?(klass)
193
+ end
194
+
195
+ alias :is_a? :kind_of?
196
+
197
+ # Checks if `self.instance_of?(klass)` or `object.instance_of?(klass)`
198
+ #
199
+ # @param [Class] klass
200
+ def instance_of?(klass)
201
+ super || object.instance_of?(klass)
202
+ end
203
+
188
204
  delegate :to_s
189
205
 
190
206
  # In case object is nil
@@ -251,7 +267,7 @@ module Draper
251
267
  if object.applied_decorators.last == self.class
252
268
  @context = object.context unless options.has_key?(:context)
253
269
  @object = object.object
254
- elsif object.applied_decorators.include?(self.class)
270
+ else
255
271
  warn "Reapplying #{self.class} decorator to target that is already decorated with it. Call stack:\n#{caller(1).join("\n")}"
256
272
  end
257
273
  end
@@ -1,3 +1,3 @@
1
1
  module Draper
2
- VERSION = '4.0.5'
2
+ VERSION = '4.0.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: draper
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.5
4
+ version: 4.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Casimir
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-11-12 00:00:00.000000000 Z
12
+ date: 2025-11-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport