class Fenix::Response
Attributes
body[RW]
headers[RW]
status[RW]
Public Class Methods
new(body: [], status: 200, headers: { 'Content-Type' => 'text/html; charset=utf-8' })
click to toggle source
# File lib/fenix/core/response.rb, line 7 def initialize(body: [], status: 200, headers: { 'Content-Type' => 'text/html; charset=utf-8' }) @body, @headers, @status = body, headers, status end
Public Instance Methods
[](key)
click to toggle source
# File lib/fenix/core/response.rb, line 20 def [](key) @headers[key] end
[]=(key, value)
click to toggle source
# File lib/fenix/core/response.rb, line 24 def []=(key, value) @headers[key] = value end
finish()
click to toggle source
# File lib/fenix/core/response.rb, line 11 def finish headers['Content-Length'] ||= body.each.map(&:size).inject(0, &:+).to_s [status, headers, body] end
write(string)
click to toggle source
# File lib/fenix/core/response.rb, line 16 def write(string) self.body << string end