Sha256: 2cc0e230b7b4473fc8b3df9c46b22ebcabfcf2d2de2c0b2f1ae29743ed49db70

Contents?: true

Size: 300 Bytes

Versions: 2

Compression:

Stored size: 300 Bytes

Contents

json = Http::MimeType.new 'application/json', :json

json.parse_with do |obj|
  if defined?(JSON) and JSON.respond_to? :parse
    JSON.parse(obj)
  else
    obj
  end
end

json.emit_with do |obj|
  if obj.is_a? String
    obj
  elsif obj.respond_to? :to_json
    obj.to_json
  else
    obj
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
http-0.5.0.pre lib/http/mime_types/json.rb
http-0.4.0 lib/http/mime_types/json.rb