Class: Modern::Descriptor::Converters::Output::Base

Inherits:
Struct
  • Object
show all
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

Instance Method Summary collapse

Methods included from Struct::Copy

#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_typeObject (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