class Net::Hippie::ContentTypeMapper

Converts a ruby hash into a JSON string

Public Instance Methods

map_from(headers, body) click to toggle source
# File lib/net/hippie/content_type_mapper.rb, line 7
def map_from(headers, body)
  return body if body.is_a?(String)

  content_type = headers['Content-Type'] || ''
  return JSON.generate(body) if content_type.include?('json')

  body
end