summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-07-11 23:54:13 -0400
committerSamuel Giddins <segiddins@segiddins.me>2016-07-19 17:13:44 -0500
commit18a1fce052f8b0345d518812a128bbc4fe2519ce (patch)
tree755c424edc99dd842731728a9f6737a10d3567da
parentbdffe5f02d91bcdf5c71537746189b9974e8ea97 (diff)
downloadbundler-18a1fce052f8b0345d518812a128bbc4fe2519ce.tar.gz
[RubygemsIntegration] Support for old ruby & rubygems
-rw-r--r--lib/bundler/rubygems_integration.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index 84e37dbd82..e3a519cd0f 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -472,7 +472,9 @@ module Bundler
@replaced_methods.each do |(sym, klass), method|
redefine_method(klass, sym, method)
end
- Gem.post_reset_hooks.reject! {|proc| proc.source_location.first == __FILE__ }
+ Gem.post_reset_hooks.reject! do |proc|
+ proc.binding.eval("__FILE__") == __FILE__
+ end
@replaced_methods.clear
end
@@ -488,7 +490,8 @@ module Bundler
nil
end
@replaced_methods[[method, klass]] = instance_method
- klass.send(:define_method, method, unbound_method || block.to_proc)
+ return unless new_method = unbound_method || (block && block.to_proc)
+ klass.send(:define_method, method, new_method)
end
# Rubygems 1.4 through 1.6