title: Ruby instance variables within class?
body: <p>So I was looking over page objects for Ruby testing here:
  <a href="http://elementalselenium.com/tips/7-use-a-page-object" rel="nofollow noreferrer">http://elementalselenium.com/tips/7-use-a-page-object</a></p>
  
  <p>And down on the page within this bit of code:</p>
  
  <pre><code>class GoogleSearch
  
    SEARCH_BOX        = { id: 'gbqfq'     }
    SEARCH_BOX_SUBMIT = { id: 'gbqfb'     }
    TOP_SEARCH_RESULT = { css: '#rso .g'  }
  
    attr_reader :driver
  
    def initialize(driver)
      @driver = driver
      visit
      verify_page
    end
  
    def visit
      driver.get ENV['base_url']
    end
  
    def search_for(search_term)
      driver.find_element(SEARCH_BOX).clear
      driver.find_element(SEARCH_BOX).send_keys search_term
      driver.find_element(SEARCH_BOX_SUBMIT).click
    end
  
    def search_result_present?(search_result)
      wait_for { displayed?(TOP_SEARCH_RESULT) }
      driver.find_element(TOP_SEARCH_RESULT).text.include? search_result
    end
  
    private
  
      def verify_page
        driver.title.include?('Google').should == true
      end
  
      def wait_for(seconds=5)
        Selenium::WebDriver::Wait.new(:timeout =&gt; seconds).until { yield }
      end
  
      def displayed?(locator)
        driver.find_element(locator).displayed?
        true
        rescue Selenium::WebDriver::Error::NoSuchElementError
          false
      end
  
  end
  </code></pre>
  
  <p>It defines <code>@driver = driver</code>, but then in all the other methods it uses just <code>driver</code>. Shouldn't all the other methods be using the initialized variable <code>@driver</code>? Or is this just simply a case of mis-documentation?</p>
  
  <p>I mean after all what was the point of declaring <code>@driver</code> if we never use it again?</p>