title: Check Ruby HTTP response for success
body: <p>How does one properly check the response from Net::HTTP::Get (for example) for "success" (i.e., a 2xx return code)?  The documentation seems to be sadly silent on this simple question.  </p>
  
  <p>I have:</p>
  
  <pre><code>response=Net::HTTP.new( host, port ).request my_get_request # details not important
  </code></pre>
  
  <p>After a bunch of Googling and near-random typing, I finally determined that this works:</p>
  
  <pre><code>response.class &lt; Net::HTTPSuccess
  </code></pre>
  
  <p>Is that actually the canonical way to do it?  </p>