class HealthRack::Controller

Public Class Methods

new(env) click to toggle source
# File lib/health_rack/controller.rb, line 8
def initialize(env)
  @request = Rack::Request.new(env)
  @response = Rack::Response.new
end

Public Instance Methods

format() click to toggle source
# File lib/health_rack/controller.rb, line 22
def format
  @format ||= begin
    md = @request.path_info.match(/\.([a-z]+)$/i) || []
    md[1] || 'html'
  end
end
perform(app) click to toggle source
# File lib/health_rack/controller.rb, line 13
def perform(app)
  renderer = renderer_class.new(app)

  renderer.render(@response)

  @response['Content-type'] = renderer.content_type
  @response.finish
end

Private Instance Methods

renderer_class() click to toggle source
# File lib/health_rack/controller.rb, line 31
def renderer_class
  @renderer_class ||= Renderers.find(format)
end