title: Is it possible to get access to keyword arguments as a Hash in Ruby?
body: <p>I know I can do:</p>
  
  <pre><code>class Parent
    def initialize(args)
      args.each do |k,v|
        instance_variable_set("@#{k}", v)
      end
    end
  end
  class A &lt; Parent
    def initialize(attrs)
      super(attrs)
    end
  end
  </code></pre>
  
  <p>But I'd want to use keyword arguments to make more clear which hash keys method may accept (and have validation saying that this key isn't supported).</p>
  
  <p>So I can write:</p>
  
  <pre><code>class A
    def initialize(param1: 3, param2: 4)
      @param1 = param1
      @param2 = param2
    end
  end
  </code></pre>
  
  <p>But is it possible to write something shorter instead of <code>@x = x; @y = y; ...</code> to initialize instance variables from passed keyword arguments? Is it possible to get access to passed keyword arguments as a Hash?</p>