In Files

Parent

Class/Module Index [+]

Quicksearch

Cuba::Response

Attributes

body[R]
headers[R]
status[RW]

Public Class Methods

new(status = nil, headers = {}) click to toggle source
# File lib/cuba.rb, line 11
def initialize(status = nil, headers = {})
  @status  = status
  @headers = headers
  @body    = []
  @length  = 0
end

Public Instance Methods

[](key) click to toggle source
# File lib/cuba.rb, line 18
def [](key)
  @headers[key]
end
[]=(key, value) click to toggle source
# File lib/cuba.rb, line 22
def []=(key, value)
  @headers[key] = value
end
finish() click to toggle source
# File lib/cuba.rb, line 39
def finish
  [@status, @headers, @body]
end
redirect(path, status = 302) click to toggle source
# File lib/cuba.rb, line 34
def redirect(path, status = 302)
  @headers["Location"] = path
  @status  = status
end
write(str) click to toggle source
# File lib/cuba.rb, line 26
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.