Module: Kernel

Defined in:
lib/web_console/extensions.rb

Class Method Summary collapse

Class Method Details

.console(binding = WebConsole.caller_bindings.first) ⇒ Object

Instructs Web Console to render a console in the specified binding.

If bidning isn’t explicitly given it will default to the binding of the previous frame. E.g. the one that invoked console.

Raises DoubleRenderError if a double console invocation per request is detected.



11
12
13
14
15
16
17
18
19
20
# File 'lib/web_console/extensions.rb', line 11

def console(binding = WebConsole.caller_bindings.first)
  raise WebConsole::DoubleRenderError if Thread.current[:__web_console_binding]

  Thread.current[:__web_console_binding] = binding

  # Make sure nothing is rendered from the view helper. Otherwise
  # you're gonna see unexpected #<Binding:0x007fee4302b078> in the
  # templates.
  nil
end