Class: WebConsole::Mapper

Inherits:
Object
  • Object
show all
Defined in:
lib/web_console/mapper.rb

Instance Method Summary collapse

Constructor Details

#initialize(exception) ⇒ Mapper

Returns a new instance of Mapper.



3
4
5
6
# File 'lib/web_console/mapper.rb', line 3

def initialize(exception)
  @exception = exception
  @bindings = exception.bindings
end

Instance Method Details

#[](index) ⇒ Object



8
9
10
11
12
# File 'lib/web_console/mapper.rb', line 8

def [](index)
  trace = @exception.backtrace[index]
  file, line = trace.to_s.strip(':')
  @bindings.find { |b| b.eval('__FILE__') == file && b.eval('__LINE__') == line }
end