Sha256: 4d333e1747efd176488cddf220d9a2ab430cc3b44df761c342e7b52359f4809b

Contents?: true

Size: 562 Bytes

Versions: 7

Compression:

Stored size: 562 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

7 entries across 7 versions & 1 rubygems

Version Path
picky-1.4.1 lib/picky/adapters/rack/base.rb
picky-1.4.0 lib/picky/adapters/rack/base.rb
picky-1.3.4 lib/picky/adapters/rack/base.rb
picky-1.3.3 lib/picky/adapters/rack/base.rb
picky-1.3.2 lib/picky/adapters/rack/base.rb
picky-1.3.1 lib/picky/adapters/rack/base.rb
picky-1.3.0 lib/picky/adapters/rack/base.rb