Method: WebConsole::Session.from

Defined in:
lib/web_console/session.rb

.from(storage) ⇒ Object

Create a Session from an binding or exception in a storage.

The storage is expected to respond to #[]. The binding is expected in :__web_console_binding and the exception in :__web_console_exception.

Can return nil, if no binding or exception have been preserved in the storage.



32
33
34
35
36
37
38
# File 'lib/web_console/session.rb', line 32

def from(storage)
  if exc = storage[:__web_console_exception]
    new(ExceptionMapper.follow(exc))
  elsif binding = storage[:__web_console_binding]
    new([[binding]])
  end
end