Project

General

Profile

Bug #7806

Updated by nobu (Nobuyoshi Nakada) over 7 years ago

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

 code: 
   class 
 (({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})) #inspect method use the #(({name})) #name one? 

 maybe #(({alias?})) #alias? and #(({alias_target})) #alias_target and maybe (({inspect})) inspect return something like ((%#<Method: A#ver(xyz)>%)) #<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

Back