In Files

Parent

Class/Module Index [+]

Quicksearch

Cuba::Response

Attributes

headers[R]
status[RW]

Public Class Methods

new(status = 200, headers = { "Content-Type" => "text/html; charset=utf-8" }) click to toggle source
# File lib/cuba.rb, line 10
def initialize(status = 200,
               headers = { "Content-Type" => "text/html; charset=utf-8" })

  @status  = status
  @headers = headers
  @body    = []
  @length  = 0
end

Public Instance Methods

[](key) click to toggle source
# File lib/cuba.rb, line 19
def [](key)
  @headers[key]
end
[]=(key, value) click to toggle source
# File lib/cuba.rb, line 23
def []=(key, value)
  @headers[key] = value
end
finish() click to toggle source
# File lib/cuba.rb, line 40
def finish
  [@status, @headers, @body]
end
redirect(path, status = 302) click to toggle source
# File lib/cuba.rb, line 35
def redirect(path, status = 302)
  @headers["Location"] = path
  @status  = status
end
write(str) click to toggle source
# File lib/cuba.rb, line 27
def write(str)
  s = str.to_s

  @length += s.bytesize
  @headers["Content-Length"] = @length.to_s
  @body << s
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.