class WebConsole::Session

that.
error pages only, as currently, this is the only client that needs to do
A session may be associated with multiple bindings. This is used by the
later by its id.
Each newly created session is persisted into memory and you can find it
with multiple bindings.
A session lets you persist an Evaluator instance in memory associated

def context(objpath)

Returns context of the current binding
def context(objpath)
  Context.new(@current_binding).extract(objpath)
end

def eval(input)

Returns a string of the Evaluator output.

Evaluate +input+ on the current Evaluator associated binding.
def eval(input)
  @evaluator.eval(input)
end

def find(id)

Raises NotFound error unless found in memory.
Returns a persisted session if found in memory.

Finds a persisted session in memory by its id.
def find(id)
  inmemory_storage[id]
end

def from(storage)

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

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

Create a Session from an binding or exception in a storage.
def from(storage)
  if exc = storage[:__web_console_exception]
    new(ExceptionMapper.follow(exc))
  elsif binding = storage[:__web_console_binding]
    new([[binding]])
  end
end

def initialize(exception_mappers)

def initialize(exception_mappers)
  @id = SecureRandom.hex(16)
  @exception_mappers = exception_mappers
  @evaluator         = Evaluator.new(@current_binding = exception_mappers.first.first)
  store_into_memory
end

def store_into_memory

def store_into_memory
  inmemory_storage[id] = self
end

def switch_binding_to(index, exception_object_id)

Returns nothing.

Switches the current binding to the one at specified +index+.
def switch_binding_to(index, exception_object_id)
  bindings = ExceptionMapper.find_binding(@exception_mappers, exception_object_id)
  @evaluator = Evaluator.new(@current_binding = bindings[index.to_i])
end