Module: Utopia::Controller::Handlers::JSON
- Defined in:
- lib/utopia/controller/responder.rb
Overview
Serializes controller values as JSON responses.
Constant Summary collapse
- APPLICATION_JSON =
Protocol::Media::Type.new("application", "json").freeze
Class Method Summary collapse
-
.call(context, request, media_range, object, **options) ⇒ Object
Serialize an object as JSON.
-
.content_type ⇒ Object
The media type produced by this handler.
Class Method Details
.call(context, request, media_range, object, **options) ⇒ Object
Serialize an object as JSON.
28 29 30 31 32 33 34 |
# File 'lib/utopia/controller/responder.rb', line 28 def self.call(context, request, media_range, object, **) if version = media_range.parameters["version"] [:version] = version.to_s end return object.to_json() end |
.content_type ⇒ Object
The media type produced by this handler.
38 39 40 |
# File 'lib/utopia/controller/responder.rb', line 38 def self.content_type APPLICATION_JSON end |