Bug #7806
closedinconsistency between Method#inspect and Method#name
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
        
           Updated by nobu (Nobuyoshi Nakada) over 12 years ago
          Updated by nobu (Nobuyoshi Nakada) over 12 years ago
          
          
        
        
      
      - Description updated (diff)
        
           Updated by nobu (Nobuyoshi Nakada) over 12 years ago
          Updated by nobu (Nobuyoshi Nakada) over 12 years ago
          
          
        
        
      
      - Status changed from Open to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r39222.
Hans, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
proc.c: show the given name
- proc.c (method_inspect): show the given name primarily, and
 original_id if aliased. [ruby-core:52048] [Bug #7806]
        
           Updated by ko1 (Koichi Sasada) over 12 years ago
          Updated by ko1 (Koichi Sasada) over 12 years ago
          
          
        
        
      
      - Status changed from Closed to Open
- Assignee set to nobu (Nobuyoshi Nakada)
- Target version set to 2.6
Nobu, you add new method Method#original_name on r39223.
Could you explain about it, why and what?
I make the target version of this ticket `next minor'.
If it should be applied to 2.0.0, please change it and make backport ticket.
        
           Updated by nobu (Nobuyoshi Nakada) over 12 years ago
          Updated by nobu (Nobuyoshi Nakada) over 12 years ago
          
          
        
        
      
      (13/02/14 10:38), ko1 (Koichi Sasada) wrote:
Nobu, you add new method Method#original_name on r39223.
Could you explain about it, why and what?
To obtain original method name, when the name is an alias.
I make the target version of this ticket `next minor'.
If it should be applied to 2.0.0, please change it and make backport ticket.
No, I don't think it needs to be backported.
--
Nobu Nakada
        
           Updated by naruse (Yui NARUSE) almost 8 years ago
          Updated by naruse (Yui NARUSE) almost 8 years ago
          
          
        
        
      
      - Target version deleted (2.6)
        
           Updated by jeremyevans0 (Jeremy Evans) about 6 years ago
          Updated by jeremyevans0 (Jeremy Evans) about 6 years ago
          
          
        
        
      
      - Status changed from Open to Closed