Class: Lifer::Dev::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/lifer/dev/response.rb

Overview

This class is responsible for building Rack-compatible responses for the ‘Lifer::Dev::Server`. This code would never be run in a production environment, where the Lifer builders are concerned.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ void

Builds a single, Rack-compatible response object.

Parameters:

  • path (String)

    A path URI.



13
14
15
# File 'lib/lifer/dev/response.rb', line 13

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



7
8
9
# File 'lib/lifer/dev/response.rb', line 7

def path
  @path
end

Instance Method Details

#buildArray

The Rack-compatible response. That’s an array with three items:

1. The HTTP status.
2. The HTTP headers.
3. The HTTP body response.

Returns:

  • (Array)

    A Rack-compatible response.



24
25
26
# File 'lib/lifer/dev/response.rb', line 24

def build
  [status, {"Content-Type": content_type}, contents]
end