Sha256: 96eae71f89672506e91e6c74108ee7589913c2e0a5ea12505a5722e3acae8a3a

Contents?: true

Size: 897 Bytes

Versions: 4

Compression:

Stored size: 897 Bytes

Contents

# * George Moschovitis  <gm@navel.gr>
# (c) 2004-2005 Navel, all rights reserved.
# $Id: response.rb 1 2005-04-11 11:04:30Z gmosx $

module Nitro
	
# HTTP Response. This module is included in Context.

module Response

	# The Response status.

	attr_accessor :status

	# The Response headers.

	attr_accessor :response_headers

	# The Response cookies.

	attr_accessor :response_cookies

	def content_type=(ctype)
		@response_headers['Content-Type'] = ctype
	end

	# Add a cookie to the response. Better use this
	# method to avoid precreating the cookies array
	# for every request.
	#
	# === Examples
	#
	# add_cookie('nsid', 'gmosx')
	# add_cookie(Cookie.new('nsid', 'gmosx')
	
	def add_cookie(cookie, value = nil)
		if value
			(@response_cookies ||= []) << Cookie.new(cookie, value)
		else 
			(@response_cookies ||= []) << cookie
		end
	end
	alias_method :send_cookie, :add_cookie

end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nitro-0.16.0 lib/nitro/response.rb
nitro-0.17.0 lib/nitro/response.rb
nitro-0.18.0 lib/nitro/response.rb
nitro-0.18.1 lib/nitro/response.rb