title: Gsub on a Fixnum? undefined method `gsub' for 55:Fixnum
body: <p>With the following function, I go to a site, crawl some information, am returned some JSON, and put it into the <code>@price</code> instance variable.</p>
  
  <p>The JSON that is returned to me is a number, but if the number is greater than 1000, then the number will contain a comma, so I gsub it out.</p>
  
  <pre><code>  def iteminfo(id)
      url = "http://services.runescape.com/m=itemdb_rs/api/catalogue/detail.json?item=#{id}"
      page = Nokogiri::HTML(open(url))
      info = JSON.parse(page.text)
      namefinder =  info['item']['name']
      pricefinder = info['item']['current']['price']
      name = namefinder
      @price = pricefinder.gsub(',', '').to_i
    end
  </code></pre>
  
  <p>I've already tried this:</p>
  
  <pre><code>if pricefinder.to_i &gt; 1000
    @price = pricefinder.gsub(',', '').to_i
  else
    @price = pricefinder.to_i
  end
  </code></pre>
  
  <p>which gets rid of the error, but messes up the math that is performed on <code>@price</code> How can I fix this?</p>