Class: Rack::Jasmine::Runner
- Inherits:
-
Object
- Object
- Rack::Jasmine::Runner
- Defined in:
- lib/rack/jasmine/runner.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(page) ⇒ Runner
constructor
A new instance of Runner.
- #not_found ⇒ Object
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_found ⇒ Object
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 |