title: Access parent class instance variable
body: <p>How can this work?    </p>
  
  <pre><code>class A
    attr_accessor :name
  
    def initialize params
      @name = params[:name]
      @collection &lt;&lt; B.new 
    end
  end
  
  class B &lt; A
    def initialize
      @my_name = lookup_something(&lt;parent.name&gt;)
    end
  end
  </code></pre>
  
  <p>Basically, I need a value from the parent class to use in a lookup on the child class, but I don't want to pass it explicitly if there's a better way. Is the instance var of the parent totally inaccessible in the child class? Or is this just poor hierarchy design?</p>