Class: CodeBuddy::Stack

Inherits:
Object
  • Object
show all
Defined in:
lib/code_buddy/stack.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(exception_or_string) ⇒ Stack

Returns a new instance of Stack.



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/code_buddy/stack.rb', line 6

def initialize(exception_or_string)
  if exception_or_string.is_a?(Exception)
    backtrace = exception_or_string.backtrace
    backtrace = backtrace.first.split("\n") if backtrace.size == 1  #haml errors come through this way
  else
    backtrace = exception_or_string
  end

  @stack_frames = backtrace.collect do |string|
    StackFrame.new(string)
  end
end

Instance Attribute Details

#selectedObject

Returns the value of attribute selected.



4
5
6
# File 'lib/code_buddy/stack.rb', line 4

def selected
  @selected
end

#stack_framesObject (readonly)

Returns the value of attribute stack_frames.



3
4
5
# File 'lib/code_buddy/stack.rb', line 3

def stack_frames
  @stack_frames
end

Instance Method Details

#edit(index) ⇒ Object



19
20
21
# File 'lib/code_buddy/stack.rb', line 19

def edit(index)
  @stack_frames[index].open_in_editor
end