class Xenon::JsonMarshaller

Public Instance Methods

marshal(obj) click to toggle source
# File lib/xenon/marshallers.rb, line 25
def marshal(obj)
  [obj.to_json]
end
media_type() click to toggle source
# File lib/xenon/marshallers.rb, line 21
def media_type
  MediaType::JSON
end
unmarshal(body, as:) click to toggle source
# File lib/xenon/marshallers.rb, line 29
def unmarshal(body, as:)
  as ? as.new.from_json(body.read) : JSON.load(body)
end