Class: PHPHandler::Events

Inherits:
Struct
  • Object
show all
Defined in:
lib/phuby/rails.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bodyObject

Returns the value of attribute body

Returns:

  • (Object)

    the current value of body



4
5
6
# File 'lib/phuby/rails.rb', line 4

def body
  @body
end

#codeObject

Returns the value of attribute code

Returns:

  • (Object)

    the current value of code



4
5
6
# File 'lib/phuby/rails.rb', line 4

def code
  @code
end

#headersObject

Returns the value of attribute headers

Returns:

  • (Object)

    the current value of headers



4
5
6
# File 'lib/phuby/rails.rb', line 4

def headers
  @headers
end

Instance Method Details

#header(value, op) ⇒ Object



8
9
10
11
12
# File 'lib/phuby/rails.rb', line 8

def header value, op
  k, v = value.split(': ', 2)
  self.code = 302 if k == 'Location'
  headers[k] = [headers[k], Rack::Utils.unescape(v)].compact.join "\n"
end

#send_headers(response_code) ⇒ Object



6
# File 'lib/phuby/rails.rb', line 6

def send_headers response_code;   end

#write(string) ⇒ Object



5
# File 'lib/phuby/rails.rb', line 5

def write string; body << string; end