title: DRY Ruby Initialization with Hash Argument
body: <p>I find myself using hash arguments to constructors quite a bit, especially when writing DSLs for configuration or other bits of API that the end user will be exposed to. What I end up doing is something like the following:</p>
  
  <pre><code>class Example
  
      PROPERTIES = [:name, :age]
  
      PROPERTIES.each { |p| attr_reader p }
  
      def initialize(args)
          PROPERTIES.each do |p|
              self.instance_variable_set "@#{p}", args[p] if not args[p].nil?
          end
      end
  
  end
  </code></pre>
  
  <p>Is there no more idiomatic way to achieve this? The throw-away constant and the symbol to string conversion seem particularly egregious.</p>