parent
f72ff1ab88
commit
50733344ae
|
@ -410,7 +410,8 @@ class Pry
|
|||
# it won't be garbage collected.
|
||||
name = @method.name
|
||||
|
||||
alias_list = owner.instance_methods.combination(2).select do |pair|
|
||||
all_methods_to_compare = owner.instance_methods | owner.private_instance_methods
|
||||
alias_list = all_methods_to_compare.combination(2).select do |pair|
|
||||
pair.include?(name) &&
|
||||
owner.instance_method(pair.first) == owner.instance_method(pair.last)
|
||||
end.flatten
|
||||
|
|
|
@ -468,6 +468,18 @@ describe Pry::Method do
|
|||
meth.aliases.should.not.include "eat"
|
||||
end
|
||||
|
||||
it 'should find aliases for top-level methods' do
|
||||
# top-level methods get added as private instance methods on Object
|
||||
class Object
|
||||
private
|
||||
def my_top_level_method ; end
|
||||
alias my_other_top_level_method my_top_level_method
|
||||
end
|
||||
|
||||
meth = Pry::Method.new(method(:my_top_level_method))
|
||||
meth.aliases.should.include 'my_other_top_level_method'
|
||||
end
|
||||
|
||||
unless Pry::Helpers::BaseHelpers.mri_18?
|
||||
# Ruby 1.8 doesn't support this feature.
|
||||
it 'should be able to find aliases for methods implemented in C' do
|
||||
|
|
Loading…
Reference in New Issue