Class: BitClust::Response

Inherits:
Object show all
Defined in:
lib/bitclust/requesthandler.rb

Instance Method Summary collapse

Constructor Details

#initialize(screen) ⇒ Response

Returns a new instance of Response.



307
308
309
# File 'lib/bitclust/requesthandler.rb', line 307

def initialize(screen)
  @screen = screen
end

Instance Method Details

#rack_finishObject



320
321
322
323
324
325
326
327
328
# File 'lib/bitclust/requesthandler.rb', line 320

def rack_finish
  [
    @screen.status || 200,
    {
      'Content-Type' => @screen.content_type,
    },
    [@screen.body]
  ]
end

#update(webrick_res) ⇒ Object



311
312
313
314
315
316
317
318
# File 'lib/bitclust/requesthandler.rb', line 311

def update(webrick_res)
  webrick_res.status = @screen.status if @screen.status
  webrick_res['Content-Type'] = @screen.content_type
  # webrick_res['Last-Modified'] = @screen.last_modified
  body = @screen.body
  webrick_res['Content-Length'] = body.bytesize
  webrick_res.body = body
end