title: How to DRY up my ruby exceptions in initialize method?
body: <p>I'm writing a program in Ruby with a Product class. I have some exceptions raised whenever the Product is initialized with the wrong type of arguments. Is there a way I can DRY up my raised exceptions (am I even referring to those correctly?) I appreciate the help. Code is below: </p>
  
  <pre><code>class Product
    attr_accessor :quantity, :type, :price, :imported
  
    def initialize(quantity, type, price, imported)
      raise ArgumentError.new("Type must be a string") if type.class != String
      raise ArgumentError.new("Quantity must be greater than zero") if quantity &lt;= 0
      raise ArgumentError.new("Price must be a float") if price.class != Float
  
      @quantity = quantity
      @type     = type
      @price    = price.round(2)
      @imported = imported
    end
  end
  </code></pre>