Class: RackConsole
- Inherits:
-
Object
- Object
- RackConsole
- Defined in:
- lib/rack_web_console.rb,
lib/rack_console/version.rb,
lib/rack_console/output_capture.rb,
lib/rack_console/cookie_script_storage.rb
Defined Under Namespace
Classes: CookieScriptStorage, OutputCapture
Constant Summary collapse
- VIEW_TEMPLATE =
::File.join __dir__, 'rack-console-view.erb'
- VERSION =
'0.2.0'
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(_binding = binding, storage: ->(env){ CookieScriptStorage.new env }, token: nil) ⇒ RackConsole
constructor
A new instance of RackConsole.
Constructor Details
#initialize(_binding = binding, storage: ->(env){ CookieScriptStorage.new env }, token: nil) ⇒ RackConsole
Returns a new instance of RackConsole.
11 12 13 14 |
# File 'lib/rack_web_console.rb', line 11 def initialize(_binding = binding, storage: ->(env){ CookieScriptStorage.new env }, token: nil) @storage, @binding = storage, _binding @@token ||= token || SecureRandom.base64(32) end |
Instance Method Details
#call(env) ⇒ Object
16 17 18 19 |
# File 'lib/rack_web_console.rb', line 16 def call(env) @_storage = ::Proc === @storage ? @storage[env] : @storage env['REQUEST_METHOD'] == 'POST' ? process_script(env) : render_view(env) end |