Sha256: 2365350f2dbfeae3ac73f8f77e78fb0f5a3c65df540d1acbe582e1a2d836c8a5
Contents?: true
Size: 723 Bytes
Versions: 3
Compression:
Stored size: 723 Bytes
Contents
module Medie module Json # Receives Json representations and turn them into hashes. Turn # hashes into json objects. class Driver def marshal(obj, rel) if obj.kind_of? String obj else obj.to_json end end def unmarshal(content) if content.nil? return {}.extend(Methodize).extend(Linked).use_link_type(Medie::Json::Links) end ::JSON.parse(content).extend(Methodize).extend(Linked).use_link_type(Medie::Json::Links) end def can_handle?(content_type) !(content_type.nil? || content_type.split(";")[0]!="application/json") end end Medie.registry << Driver.new end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
medie-1.0.0 | lib/medie/json/driver.rb |
medie-1.0.0.beta4 | lib/medie/json/driver.rb |
medie-1.0.0.beta3 | lib/medie/json/driver.rb |