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
57 58 59 |
# File 'opal/lib/opal/cli_runners/server.rb', line 57 def initialize(source) @source = source end |
Instance Method Details
#call(env) ⇒ Object
71 72 73 74 75 76 77 78 79 80 |
# File 'opal/lib/opal/cli_runners/server.rb', line 71 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 |