Sha256: 048c92fb08c47191c7c04a37112ffc0b61e22b277d58863deaf6de34392b8c3f

Contents?: true

Size: 552 Bytes

Versions: 2

Compression:

Stored size: 552 Bytes

Contents

module Adapters
  # Adapter that is plugged into a Rack outlet.
  #
  module Rack
  
    # Subclasses of this class should respond to
    # * to_app(options)
    #
    class Base
    
      # Puts together an appropriately structured Rack response.
      #
      # Note: Bytesize is needed to have special characters not trip up Rack.
      #
      def respond_with response, content_type = 'application/json'
        [200, { 'Content-Type' => content_type, 'Content-Length' => response.bytesize.to_s }, [response]]
      end
    
    end
  
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
picky-2.7.0 lib/picky/adapters/rack/base.rb
picky-2.6.0 lib/picky/adapters/rack/base.rb