draper 4.0.0 → 4.0.1

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: 39d1efc5af48e806f378bbd92b0d3dcf9e2811175b631e02e2aadd011d1cbf7c
4
- data.tar.gz: d758263643cfccb3f4b1c2e1635f40aa540e194647e53e47792e735d433b6d88
3
+ metadata.gz: a90d57e1df50336b735a6f16cc119a558ee8472b70bd9748c59f25b70afc319a
4
+ data.tar.gz: a4510f40a8afac7976e7afea4659d8e1c3eb981c005bc4046660b4d110874df7
5
5
  SHA512:
6
- metadata.gz: 97b2c778d94f3ffa05a4cd232668f64e1646a7a47b582e9e09eaadaa0ae912f2edb3f5f91e9f8c698832be4990f751dc1359d2bf9bbffb034cffc26145e473ec
7
- data.tar.gz: bbd454fb0379f0e7411680139a4fb3cafe5499ad6719bef19040fa93d595019dc8377820f546c8a38408ad0be81abdfd79457a446a9ded0faee04fb30bcb06e8
6
+ metadata.gz: bee71715525fdc2de5336c399b1dfe4a774d9fd68071bb01468c8f31712504cf6af8beecf1f4facf4ea25ef5bcad7a14b2e2f12bec12f7b6f1e55c04318c4f7a
7
+ data.tar.gz: 8f013f4b36efa767ada401a979e5bf10e28f068997d24fd8035e4025254300709eb7c2e80c5f0498cc49c176b7561fbff48e2cc03f39b418f368c3266bf30359
@@ -1,5 +1,13 @@
1
1
  # Draper Changelog
2
2
 
3
+ ## 4.0.1 - 2020-03-25
4
+
5
+ ### Fixes
6
+ * Check only object's private methods when preventing delegation [#875](https://github.com/drapergem/draper/pull/875)
7
+
8
+ ### Other Changes
9
+ * Use `alias` over `alias_method` [#877](https://github.com/drapergem/draper/pull/877)
10
+
3
11
  ## 4.0.0 - 2020-02-05
4
12
 
5
13
  ### Breaking Changes
@@ -20,7 +20,7 @@ module Draper
20
20
 
21
21
  # @private
22
22
  def delegatable?(method)
23
- return if private_methods.include?(method)
23
+ return if private_methods(false).include?(method)
24
24
 
25
25
  object.respond_to?(method)
26
26
  end
@@ -14,9 +14,9 @@ module Draper
14
14
  extend ActiveSupport::Concern
15
15
 
16
16
  included do
17
- alias_method :previous_render_to_body, :render_to_body
17
+ alias :previous_render_to_body :render_to_body
18
18
  include ActionView::Rendering
19
- alias_method :render_to_body, :previous_render_to_body
19
+ alias :render_to_body :previous_render_to_body
20
20
  end
21
21
  end
22
22
  end
@@ -1,3 +1,3 @@
1
1
  module Draper
2
- VERSION = '4.0.0'
2
+ VERSION = '4.0.1'
3
3
  end
@@ -684,6 +684,18 @@ module Draper
684
684
  expect{ decorator.hello_world }.to raise_error NoMethodError
685
685
  end
686
686
  end
687
+
688
+ context 'when delegated method has the same name as private method defined on another object' do
689
+ let(:decorator_class) { Class.new(Decorator) }
690
+ let(:object) { Class.new { def print; end }.new }
691
+
692
+ it 'delegates the public method defined on the object' do
693
+ decorator = decorator_class.new(object)
694
+
695
+ # `print` private method is defined on `Object`
696
+ expect{ decorator.print }.not_to raise_error NoMethodError
697
+ end
698
+ end
687
699
  end
688
700
 
689
701
  context ".method_missing" do
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.0
4
+ version: 4.0.1
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: 2020-02-05 00:00:00.000000000 Z
12
+ date: 2020-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -384,7 +384,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
384
384
  - !ruby/object:Gem::Version
385
385
  version: '0'
386
386
  requirements: []
387
- rubygems_version: 3.0.2
387
+ rubygems_version: 3.0.8
388
388
  signing_key:
389
389
  specification_version: 4
390
390
  summary: View Models for Rails