@@ -200,24 +200,17 @@ def restore_original_method!(method_name)
200
200
remove_method method_name
201
201
202
202
# A @klass can have methods implemented (see Method#owner) in @klass
203
- # or inherited from a superclass. In ruby 2.2 and earlier, we can copy
204
- # a method regardless of the 'owner' and restore it to @klass after
205
- # because a call to 'super' from @klass's copied method would end up
206
- # calling the original class's superclass's method.
203
+ # or inherited from a superclass.
207
204
#
208
- # With the commit below, available starting in 2.3.0, ruby changed
209
- # this behavior and a call to 'super' from the method copied to @klass
205
+ # A call to 'super' from the method copied to @klass
210
206
# will call @klass's superclass method, which is the original
211
207
# implementer of this method! This leads to very strange errors
212
208
# if @klass's copied method calls 'super', since it would end up
213
209
# calling itself, the original method implemented in @klass's
214
210
# superclass.
215
211
#
216
- # For ruby 2.3 and above, we need to only restore methods that
217
- # @klass originally owned.
218
- #
219
- # https://github.com/ruby/ruby/commit/c8854d2ca4be9ee6946e6d17b0e17d9ef130ee81
220
- if RUBY_VERSION < "2.3" || backed_up_method_owner [ method_name . to_sym ] == self
212
+ # We need to only restore methods that @klass originally owned.
213
+ if backed_up_method_owner [ method_name . to_sym ] == self
221
214
alias_method method_name , alias_method_name
222
215
end
223
216
remove_method alias_method_name
0 commit comments