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-4.0.0pre1 lib/picky/adapters/rack/base.rb
picky-3.6.16 lib/picky/adapters/rack/base.rb
picky-3.6.15 lib/picky/adapters/rack/base.rb
picky-3.6.14 lib/picky/adapters/rack/base.rb
picky-3.6.13 lib/picky/adapters/rack/base.rb
picky-3.6.12 lib/picky/adapters/rack/base.rb
picky-3.6.11 lib/picky/adapters/rack/base.rb
picky-3.6.10 lib/picky/adapters/rack/base.rb
picky-3.6.9 lib/picky/adapters/rack/base.rb
picky-3.6.8 lib/picky/adapters/rack/base.rb
picky-3.6.7 lib/picky/adapters/rack/base.rb
picky-3.6.6 lib/picky/adapters/rack/base.rb
picky-3.6.4 lib/picky/adapters/rack/base.rb
picky-3.6.3 lib/picky/adapters/rack/base.rb
picky-3.6.2 lib/picky/adapters/rack/base.rb
picky-3.6.1 lib/picky/adapters/rack/base.rb
picky-3.6.0 lib/picky/adapters/rack/base.rb
picky-3.5.4 lib/picky/adapters/rack/base.rb
picky-3.5.3 lib/picky/adapters/rack/base.rb
picky-3.5.2 lib/picky/adapters/rack/base.rb