Class: Opal::CliRunners::Server::App
- Inherits:
-
Object
- Object
- Opal::CliRunners::Server::App
- Defined in:
- opal/lib/opal/cli_runners/server.rb
Constant Summary
- BODY =
<<-HTML <!doctype html> <html> <head> <meta charset="utf-8"/> <script src="/cli_runner.js"></script> </head> </html> HTML
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(source) ⇒ App
constructor
A new instance of App.
Constructor Details
#initialize(source) ⇒ App
Returns a new instance of App
55 56 57 |
# File 'opal/lib/opal/cli_runners/server.rb', line 55 def initialize(source) @source = source end |
Instance Method Details
#call(env) ⇒ Object
69 70 71 72 73 74 75 76 77 78 |
# File 'opal/lib/opal/cli_runners/server.rb', line 69 def call(env) case env['PATH_INFO'] when '/' [200, {'Content-Type' => 'text/html'}, [BODY]] when '/cli_runner.js' [200, {'Content-Type' => 'text/javascript'}, [@source]] else [404, {}, ['not found']] end end |