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.



311
312
313
# File 'lib/bitclust/requesthandler.rb', line 311

def initialize(screen)
  @screen = screen
end

Instance Method Details

#rack_finishObject



325
326
327
328
329
330
331
332
333
# File 'lib/bitclust/requesthandler.rb', line 325

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

#update(webrick_res) ⇒ Object



315
316
317
318
319
320
321
322
323
# File 'lib/bitclust/requesthandler.rb', line 315

def update(webrick_res)
  status = @screen.status
  webrick_res.status = status if 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