I have a question regarding inheritance from built-in classes. To simplify
it, say I want to create a time-stamped array, which is an array with a
time-stamp. Then I want to override the to_s method. I tried the following
code:
                       
                                                         
class Time_stamped_array < Array                                                
  def initialize                                                                
    @time_stamp = Time.now                                                      
  end                                                                           
                                                                                
  def to_s                                                                      
    super + " #{@time_stamp}"                                                   
  end                                                                           

end                                                                             
                                                                                
ta = Time_stamped_array.new                                                     
                                                                                
puts ta.to_s                                                                    
                                                                                

However this last call seems to invoke to_s in the super class (Array)          
and not in my new class. How do I do what I intented to do instead?             
Isn't it possible to override built-in methods?                                 
                                                                                
Thanks in advance.                                                              
                                                                                
--                                                                              
best regards                                                                    
Nicolaj SÝÓdberg-Madsen