lib/wordnik/response.rb in wordnik-4.06.10 vs lib/wordnik/response.rb in wordnik-4.06.11
- old
+ new
@@ -48,26 +48,26 @@
end
# Extract the response format from the header hash
# e.g. {'Content-Type' => 'application/json'}
def format
- headers['Content-Type'].split("/").last.to_sym
+ headers['Content-Type'].split("/").last.to_s
end
def json?
- format == :json
+ format == 'json'
end
def xml?
- format == :xml
+ format == 'xml'
end
def pretty_body
return unless body.present?
case format
- when :json
+ when 'json'
JSON.pretty_generate(body).gsub(/\n/, '<br/>')
- when :xml
+ when 'xml'
xsl = Nokogiri::XSLT(File.open(File.join(File.dirname(__FILE__), "../../config/pretty_print.xsl")))
xml = Nokogiri(body)
coder = HTMLEntities.new
coder.encode(xsl.apply_to(xml).to_s)
end
\ No newline at end of file