Class: IRWebmachine::Pry::PrintStack

Inherits:
Pry::ClassCommand
  • Object
show all
Defined in:
lib/irwebmachine/pry/print_stack.rb

Instance Method Summary collapse

Instance Method Details

#options(opt) ⇒ Object



18
19
20
# File 'lib/irwebmachine/pry/print_stack.rb', line 18

def options(opt)
  opt.on :f, 'Filter the stack with a regular expression.', optional: true
end

#processObject



22
23
24
25
26
27
28
29
# File 'lib/irwebmachine/pry/print_stack.rb', line 22

def process
  frames = stack.to_a.map do |frame|
    if frame.ruby_call? && frame.to_s =~ filter
      frame.to_s
    end
  end.compact.join "\n"
  stagger_output text.with_line_numbers(frames, 0)
end

#setupObject



14
15
16
# File 'lib/irwebmachine/pry/print_stack.rb', line 14

def setup
  @app = target.eval "app"
end