Project

General

Profile

Actions

Bug #7806

closed

inconsistency between Method#inspect and Method#name

Added by Hanmac (Hans Mackowiak) almost 12 years ago. Updated over 5 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
[ruby-core:52048]

Description

=begin
it seems that Method#inspect does some magic with alias methods

code:
class A
def xyz
end
alias ver xyz
end

p A.instance_method(:ver) #<UnboundMethod: A#xyz>
p A.instance_method(:ver).name #:ver

a=A.new
p a.method(:ver) #<Method: A#xyz>
p a.method(:ver).name #:ver

shouldn't the #(({inspect})) method use the #(({name})) one?

maybe #(({alias?})) and #(({alias_target})) and maybe (({inspect})) return something like ((%#<Method: A#ver(xyz)>%)) so it can be seen that the method is an alias?

PS: sorry i cant get the code tag working currectly

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0