title: Trying to return class instance from class method in ruby
body: <p>I'm trying to write a wrapper around the rest api for Neo4j. The other ORMs I've found don't quite do what I need them to do. I want to have something that mimics ActiveRecord, but for a graph database. So when I do somethiing like "NeoRest.find(id=1)" I want it to return the database record that corresponds to that id, but I want to return it as a NeoRest instance. My code is below. I've looked all over the web and can't find anything to help me out -- hopefully this isn't a stupid question =\</p>
  
  <pre><code>require 'net/http'
  require 'uri'
  require 'json'
  
  class NeoRest
  
      def NeoRest.post(key = nil, value = nil)
  #       NeoRest.new
  
          base_url= URI('http://localhost:7474/db/data/node/')
  
          response = Net::HTTP.post_form(base_url, {key =&gt; value})
          decode=JSON.parse(response.body)
          puts decode["self"]
          puts decode["data"]
      end #testrest
  end #class
  
  bob=NeoRest.post("name", "josh")
  puts bob.class #=&gt; nilclass -- want thiis to be =&gt;NeoRest
  </code></pre>