I have this :
  def profile
    page = @agent.get(@uri)
    MultiJson.decode(page.body.gsub(/([a-zA-Z]+):/, '"\1":')) do |file|
      if file['errCode'] == 0
        return file['miniprofile']
      else
        return
{'errCode'=>file['errCode'],'errText'=>file['errText'],'uri'=>page.uri}
      end
      end
  end

This always returns the MultiJson output. (not what I want) It seems as
if it doesn't even
do the block. If I use a variable like this :

  def profile
    page = @agent.get(@uri)
    file = MultiJson.decode(page.body.gsub(/([a-zA-Z]+):/, '"\1":'))
      if file['errCode'] == 0
        return file['miniprofile']
      else
        return
{'errCode'=>file['errCode'],'errText'=>file['errText'],'uri'=>page.uri}
      end
  end

It returns one or the other inside the if statements.

Shouldn't both of these return the same thing

-- 
Posted via http://www.ruby-forum.com/.