Class: Modern::Descriptor::Converters::Input::Base
- Defined in:
- lib/modern/descriptor/converters/input/base.rb
Overview
An input converter takes a raw HTTP request body (as a ‘StringIO`) and returns a Ruby object. A JSON converter would return a hash, for example; a converter for ’image/* might return the ‘StringIO` object without alteration. The results of this converter will be passed into against a Types::Type if one has been provided (which will cause a validation check) before being passed into the route action.
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.
18 19 20 21 |
# File 'lib/modern/descriptor/converters/input/base.rb', line 18 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.
16 17 18 |
# File 'lib/modern/descriptor/converters/input/base.rb', line 16 def content_type @content_type end |