Module: Lunetas::Candy::ResponseHandler::ClassMethods

Defined in:
lib/lunetas/candy/response_handler.rb

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Array

Support to be runned as a Rails Metal.

Parameters:

  • env (Hash)

    the Rack env.

Returns:

  • (Array)

    a standard Rack response.



68
69
70
71
72
73
74
75
76
# File 'lib/lunetas/candy/response_handler.rb', line 68

def call(env)
  url_match = env['PATH_INFO'].match(lunetas_regex)
  if url_match
    candy = new(env, url_match.to_a)
    candy.bite
  else
    [404, {"Content-Type" => "text/html", "X-Cascade" => "pass"}, ["Not Found"]]
  end
end