Project

General

Profile

Bug #15640

Updated by nobu (Nobuyoshi Nakada) about 5 years ago

If the symbol has been defined, then it is passed. Otherwise a string is passed the first time.     

 ```ruby 
     

     class SomeBug 
   
       def respond_to_missing?(m, *) 
     
         p m 
     
         true 
   
       end 
 
     end 
 
    
 
     if false then 
   
       # uncomment to force to symbol--location doesn't matter, just the literal parse: 
   
       # :aa 
 
     end 
 
    
 
     sd = SomeBug.new 
 
    
 
     # NOTE: single character strings do not show this behavior 
 
     sd.method("aa".to_sym)         # "aa" unless :aa uncommented above 
 
     sd.method("aa".to_sym)         # :aa 
 
     sd.method("bb".to_sym)         # "bb" 
 
     sd.method("bb".to_sym)         # :bb 
 ``` 

Back