title: Shorthand way of assigning attrs in Ruby when using keyword args
body: <p>In Ruby, this is a very common pattern:</p>
  <pre class="lang-rb prettyprint-override"><code>class Token
    attr_reader :type, :lexeme, :literal, :location
  
    def initialize(type:, lexeme:, literal:, location:)
      @type = type
      @lexeme = lexeme
      @literal = literal
      @location = location
    end
  end
  </code></pre>
  <p>In this code we are:</p>
  <ol>
  <li>Passing a list of variables to an <code>initialize</code> method</li>
  <li>Exposing that same list as <code>attr_readers</code></li>
  <li>Assigning the variables to ivars.</li>
  </ol>
  <p>The purpose here is to make the passed variables available anywhere in the code, without having to reference with ivars.</p>
  <p>There is a lot of of repetition here and I'm wondering if there is a shorthand way of doing this?</p>
  <p>This example was taken from the <a href="https://www.honeybadger.io/blog/building-lexer-ruby/" rel="nofollow noreferrer">Building a Toy Lexer in Ruby</a> blogpost.</p>