Class: Rack::Anystatus::Endpoint

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/anystatus/endpoint.rb

Constant Summary collapse

F =
::File

Instance Method Summary collapse

Constructor Details

#initialize(status_code, path) ⇒ Endpoint

Returns a new instance of Endpoint.



5
6
7
8
9
10
# File 'lib/rack/anystatus/endpoint.rb', line 5

def initialize(status_code, path)
    file = F.expand_path path
    @content = F.read file
    @length = @content.length.to_s
    @status_code = status_code
end

Instance Method Details

#call(env) ⇒ Object



12
13
14
# File 'lib/rack/anystatus/endpoint.rb', line 12

def call(env)
    [@status_code, {'Content-Type' => 'text/html', 'Content-Length' => @length}, [@content]]
end