Class: Rack::Webconsole
- Inherits:
-
Object
- Object
- Rack::Webconsole
- Defined in:
- lib/rack/webconsole.rb,
lib/rack/webconsole/repl.rb,
lib/rack/webconsole/shell.rb,
lib/rack/webconsole/assets.rb,
lib/rack/webconsole/railtie.rb,
lib/rack/webconsole/sandbox.rb,
lib/rack/webconsole/version.rb,
lib/rack/webconsole/asset_helpers.rb
Overview
Webconsole is a Rack middleware that provides an interactive console à la Rails console, but for any kind of Rack application (Rails, Sinatra, Padrino…), accessible from your web application’s front-end.
For every request, it normally passes control to the Assets middleware, which injects needed JavaScript, CSS and HTML code for the console to work properly.
It also exposes a special route used by the Repl, a Ruby evaluator which is responsible of keeping state between requests, remembering local variables and giving a true IRB-esque experience.
Defined Under Namespace
Modules: AssetHelpers, Shell Classes: Assets, Railtie, Repl, Sandbox
Constant Summary collapse
- VERSION =
rack-webconsole version number.
"0.1.5"
- @@config =
{:inject_jquery => false, :key_code => "96"}
Class Method Summary collapse
-
.inject_jquery ⇒ Boolean
Returns whether the Asset injecter must inject JQuery or not.
-
.inject_jquery=(value) ⇒ Object
Sets whether the Asset injecter must inject JQuery or not.
-
.key_code ⇒ String
Returns key code used to start web console.
-
.key_code=(value) ⇒ Object
Sets key code used to start web console.
Instance Method Summary collapse
-
#call(env) ⇒ Object
Decides where to send the request.
-
#initialize(app) ⇒ Webconsole
constructor
Honor the Rack contract by saving the passed Rack application in an ivar.
Constructor Details
#initialize(app) ⇒ Webconsole
Honor the Rack contract by saving the passed Rack application in an ivar.
65 66 67 |
# File 'lib/rack/webconsole.rb', line 65 def initialize(app) @app = app end |
Class Method Details
.inject_jquery ⇒ Boolean
Returns whether the Asset injecter must inject JQuery or not.
34 35 36 |
# File 'lib/rack/webconsole.rb', line 34 def inject_jquery @@config[:inject_jquery] end |
.inject_jquery=(value) ⇒ Object
Sets whether the Asset injecter must inject JQuery or not.
41 42 43 |
# File 'lib/rack/webconsole.rb', line 41 def inject_jquery=(value) @@config[:inject_jquery] = value end |
.key_code ⇒ String
Returns key code used to start web console.
48 49 50 |
# File 'lib/rack/webconsole.rb', line 48 def key_code @@config[:key_code] end |
.key_code=(value) ⇒ Object
Sets key code used to start web console.
55 56 57 58 |
# File 'lib/rack/webconsole.rb', line 55 def key_code=(value) value = value.to_s unless value.is_a?(String) @@config[:key_code] = value end |