Sha256: 845aac0f12a21f4252f5e800ca4d98a8f498c778376855259c1404030d07116a
Contents?: true
Size: 752 Bytes
Versions: 6
Compression:
Stored size: 752 Bytes
Contents
# frozen_string_literal: true module Modern module Descriptor module Converters module Output # 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. class Base < Modern::Struct attr_reader :content_type def initialize(fields) super @content_type = ContentType.parse(media_type).freeze end attribute :media_type, Types::MIMEType attribute :converter, Types.Instance(Proc) end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems