title: Mechanism of overridding methods in a Ruby class
body: <p>Suppose I want to override a method of an existing class <code>Array</code> as below.</p>
  
  <pre><code>class Array
    def to_s
      self.join(',')
    end
  end
  </code></pre>
  
  <p>So my question is - How does this overriding work? Does this add this definition of method to_s to the class <code>Array</code>? I mean if the class contained 'n' method definitions, it would now contain 'n+1' method definitions. Also, is it that there are two definitions of <code>to_s</code> method and the one that is added last is the one that would work?</p>
  
  <p>Thanks.</p>