diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2016-06-13 15:49:16 -0700 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2016-06-14 15:47:37 -0700 |
commit | bb34863740d55a66db1d4266ddf294c30ede3c93 (patch) | |
tree | 9f9960542794b1120f5fc5094223b48dcd6d23d4 /lib | |
parent | 13f64fa210edbf92f3281e4055e88a37437d0486 (diff) | |
download | bundler-bb34863740d55a66db1d4266ddf294c30ede3c93.tar.gz |
[RubygemsIntegration] Allow redefining private methods
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/rubygems_integration.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 41ebc87c..28259b72 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -462,8 +462,14 @@ module Bundler end def redefine_method(klass, method, &block) - if klass.instance_methods(false).include?(method) - klass.send(:remove_method, method) + begin + if klass.instance_method(method) && method != :initialize + # doing this to ensure we also get private methods + klass.send(:remove_method, method) + end + rescue NameError + # method isn't defined + nil end klass.send(:define_method, method, &block) end |