Class: Modern::Descriptor::Converters::Output::Base
- Defined in:
- lib/modern/descriptor/converters/output/base.rb
Overview
An output converter takes a Ruby object and returns the raw contents of an HTTP response body. A JSON converter would invoke ‘JSON.generate` on a Ruby object to yield UTF-8 text; a binary converter would take an IO and dump its contents into the HTTP stream.
Instance Attribute Summary collapse
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
Instance Method Summary collapse
-
#initialize(fields) ⇒ Base
constructor
A new instance of Base.
Methods included from Struct::Copy
Constructor Details
#initialize(fields) ⇒ Base
Returns a new instance of Base.
14 15 16 17 |
# File 'lib/modern/descriptor/converters/output/base.rb', line 14 def initialize(fields) super @content_type = ContentType.parse(media_type).freeze end |
Instance Attribute Details
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
12 13 14 |
# File 'lib/modern/descriptor/converters/output/base.rb', line 12 def content_type @content_type end |