title: Ruby class initialize override module initialize
body: <p>I am using <code>super</code> to pass arguments to the parent <code>initialize</code> method, which is not called by default. This is what it looks like. (Notice the use of <code>super</code> on the last two arguments)</p>
  
  <pre><code>module Pet
    def initialize name, is_pet
      @is_pet = is_pet
      if is_pet
        @name = name
      else
        @name = "Unnamed"
      end
    end
    def pet?
      return @is_pet
    end
    def get_name
      return @name
    end
  end
  
  class Dog
    include Pet
    def initialize tricks, name, is_pet
      @tricks = tricks
      super name, is_pet
    end
    def get_tricks
      return @tricks
    end
  end
  </code></pre>
  
  <p>Here's what I can do with it:</p>
  
  <pre><code>d = Dog.new ["roll", "speak", "play dead"], "Spots", true
  
  d.pet?       #=&gt; true
  d.get_tricks #=&gt; ["roll", "speak", "play dead"]
  d.get_name   #=&gt; "Spots"
  </code></pre>
  
  <p>It works fine, but I'm just wondering if there's a better way to do this.</p>