title: What is the most efficient way to initialize a Class in Ruby with different parameters and default values?
body: <p>I would like to have a class and some attributes which you can either set during initialization or use its default value.</p>
  
  <pre><code>class Fruit
    attr_accessor :color, :type
    def initialize(color, type)
      @color=color ||= 'green'
      @type=type ||='pear'
    end
  end
  
  apple=Fruit.new(red, apple)
  </code></pre>