Module: Kernul::Response

Defined in:
lib/kernul/response.rb

Class Method Summary collapse

Class Method Details

.default(error = '') ⇒ Object

The Rack array if there was an uncaught error or something horrible occured



23
24
25
26
27
# File 'lib/kernul/response.rb', line 23

def default(error='')
  [ 500, {
    'Content-Type' => 'text/plain'
  }, error.to_s ]
end

.invalid_keyObject

The Rack array for an invalid symbol and/or key



8
9
10
11
12
13
# File 'lib/kernul/response.rb', line 8

def invalid_key
  [ 401, {
    'Content-Type' => 'text/plain',
    'WWW-Authenticate' => "Basic realm=\"#{Kernul::Base.url}\""
  }, 'Invalid key' ]
end

.invalid_targetObject

The Rack array if the target doesn’t exist or no target is provided



16
17
18
19
20
# File 'lib/kernul/response.rb', line 16

def invalid_target
  [ 400, {
    'Content-Type' => 'text/plain'
  }, 'Invalid target' ]
end