Class: IRB::ExtendCommand::Trace
- Inherits:
-
TraceCommand
- Object
- Nop
- TraceCommand
- IRB::ExtendCommand::Trace
- Defined in:
- lib/ruby_tracer/irb.rb
Instance Method Summary collapse
Methods inherited from TraceCommand
Instance Method Details
#execute(*args) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/ruby_tracer/irb.rb', line 48 def execute(*args) args = args.first.split(/,/, 2) case args.size when 1 target = irb_context.workspace.main expression = args.first when 2 target = eval(args.first, irb_context.workspace.binding) expression = args.last else raise ArgumentError, "wrong number of arguments (given #{args.size}, expected 1..2)" end b = irb_context.workspace.binding Tracer.trace(target) { eval(expression, b) } end |