Class: Rack::Jasmine::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/jasmine/runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(page) ⇒ Runner

Returns a new instance of Runner.



5
6
7
# File 'lib/rack/jasmine/runner.rb', line 5

def initialize(page)
  @page = page
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/rack/jasmine/runner.rb', line 9

def call(env)
  @path = env["PATH_INFO"]
  return not_found if @path != "/"
  [
    200,
    { 'Content-Type' => 'text/html'},
    [@page.render]
  ]
end

#not_foundObject



19
20
21
22
23
# File 'lib/rack/jasmine/runner.rb', line 19

def not_found
  [404, {"Content-Type" => "text/plain",
         "X-Cascade" => "pass"},
         ["File not found: #{@path}\n"]]
end