Class: Phuby::PHPHandler::Events

Inherits:
Events
  • Object
show all
Defined in:
lib/phuby/php_handler.rb

Instance Method Summary collapse

Constructor Details

#initialize(req, res) ⇒ Events

Returns a new instance of Events.



9
10
11
12
13
# File 'lib/phuby/php_handler.rb', line 9

def initialize req, res
  super()
  @req = req
  @res = res
end

Instance Method Details

#header(value, op) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/phuby/php_handler.rb', line 15

def header value, op
  k, v = *value.split(':', 2)
  if k.downcase == 'set-cookie'
    @res.cookies << v.strip
  else
    @res[k] = v.strip
  end
end

#send_headers(response_code) ⇒ Object



29
30
# File 'lib/phuby/php_handler.rb', line 29

def send_headers response_code
end

#write(string) ⇒ Object



24
25
26
27
# File 'lib/phuby/php_handler.rb', line 24

def write string
  @res.body ||= ''
  @res.body << string
end