Sha256: b585653423a8dc64484dc8e4e4ba95f3f957babcdb3d4c7261d522660d20d49c

Contents?: true

Size: 595 Bytes

Versions: 52

Compression:

Stored size: 595 Bytes

Contents

module Picky

  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

end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
picky-3.1.4 lib/picky/adapters/rack/base.rb
picky-3.1.3 lib/picky/adapters/rack/base.rb
picky-3.1.2 lib/picky/adapters/rack/base.rb
picky-3.1.1 lib/picky/adapters/rack/base.rb
picky-3.1.0 lib/picky/adapters/rack/base.rb
picky-3.0.1 lib/picky/adapters/rack/base.rb
picky-3.0.0 lib/picky/adapters/rack/base.rb
picky-3.0.0.pre5 lib/picky/adapters/rack/base.rb
picky-3.0.0.pre4 lib/picky/adapters/rack/base.rb
picky-3.0.0.pre3 lib/picky/adapters/rack/base.rb
picky-3.0.0.pre2 lib/picky/adapters/rack/base.rb
picky-3.0.0.pre1 lib/picky/adapters/rack/base.rb