diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2016-07-14 10:43:42 -0400 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2016-07-19 17:13:44 -0500 |
commit | d7cafc4f75d62745f9eb695f272435c4b18b9eda (patch) | |
tree | 276610a22e032ec4f1cf51abf6811e446f8240ac | |
parent | 18a1fce052f8b0345d518812a128bbc4fe2519ce (diff) | |
download | bundler-d7cafc4f75d62745f9eb695f272435c4b18b9eda.tar.gz |
[RubygemsIntegration] Fix <2 compat with returns in redefined methods
-rw-r--r-- | lib/bundler/rubygems_integration.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index e3a519cd0f..fd70f4ce95 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -479,7 +479,6 @@ module Bundler end def redefine_method(klass, method, unbound_method = nil, &block) - # puts "redefining #{klass} #{method} to #{unbound_method || block}" begin if (instance_method = klass.instance_method(method)) && method != :initialize # doing this to ensure we also get private methods @@ -490,8 +489,11 @@ module Bundler nil end @replaced_methods[[method, klass]] = instance_method - return unless new_method = unbound_method || (block && block.to_proc) - klass.send(:define_method, method, new_method) + if unbound_method + klass.send(:define_method, method, unbound_method) + elsif block + klass.send(:define_method, method, &block) + end end # Rubygems 1.4 through 1.6 |