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.


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

def initialize(screen)
  @screen = screen
end

Instance Method Details

#rack_finishObject


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

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

#update(webrick_res) ⇒ Object


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

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