Class: Midori::CleanRoom

Inherits:
Object
  • Object
show all
Defined in:
lib/midori/clean_room.rb

Overview

This class is used to be sandbox of requests processing.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ CleanRoom

Init a Cleanroom for running

Parameters:



12
13
14
15
16
17
# File 'lib/midori/clean_room.rb', line 12

def initialize(request)
  @status = 200
  @header = Midori::Const::DEFAULT_HEADER.clone
  @body = ''
  @request = request
end

Instance Attribute Details

#bodyObject

HTTP response body. String could is accepted by default, but could leave for further process with Midori::Middleware

Returns:

  • (Object)

    the current value of body



7
8
9
# File 'lib/midori/clean_room.rb', line 7

def body
  @body
end

#headerHash

HTTP response header

Returns:

  • (Hash)

    the current value of header



7
8
9
# File 'lib/midori/clean_room.rb', line 7

def header
  @header
end

#requestMidori::Request

HTTP request

Returns:



7
8
9
# File 'lib/midori/clean_room.rb', line 7

def request
  @request
end

#statusInteger

HTTP response code

Returns:

  • (Integer)

    the current value of status



7
8
9
# File 'lib/midori/clean_room.rb', line 7

def status
  @status
end

Instance Method Details

#raw_responseMidori::Response

Generate response from variables inside Midori::CleanRoom

Returns:



21
22
23
# File 'lib/midori/clean_room.rb', line 21

def raw_response
  Midori::Response.new(status: @status, header: @header, body: @body)
end