# File lib/stella/client.rb, line 296 def doc return @doc unless @doc.nil? return nil if @res.content.nil? || @res.content.empty? str = RUBY_VERSION >= "1.9.0" ? @res.content.force_encoding("UTF-8") : @res.content # NOTE: It's important to parse the document on every # request because this container is available for the # entire life of a usecase. @doc = case (@res.header['Content-Type'] || []).first when /text\/html/ Nokogiri::HTML(str) when /text\/xml/ Nokogiri::XML(str) when /text\/yaml/ YAML.load(str) when /application\/json/ Yajl::Parser.parse(str) end @doc.replace indifferent_params(@doc) if Hash === @doc @doc end