title: How to get attributes that were defined through attr_reader or attr_accessor
body: <p>Suppose I have a class <code>A</code></p>
  
  <pre><code>class A
    attr_accessor :x, :y
  
    def initialize(x,y)
      @x, @y = x, y
    end
  end
  </code></pre>
  
  <p>How can I get <code>x</code> and <code>y</code> attributes without knowing how exactly they were named. </p>
  
  <p>E.g.</p>
  
  <pre><code>a = A.new(5,10)
  a.attributes # =&gt; [5, 10]
  </code></pre>