Class: Debugger::InspectCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/debugger/xml/extensions/commands/inspect.rb

Constant Summary collapse

@@references =

reference inspection results in order to save them from the GC

[]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.clear_referencesObject



8
9
10
# File 'lib/debugger/xml/extensions/commands/inspect.rb', line 8

def self.clear_references
  @@references = []
end

.reference_result(result) ⇒ Object



5
6
7
# File 'lib/debugger/xml/extensions/commands/inspect.rb', line 5

def self.reference_result(result)
  @@references << result
end

Instance Method Details

#executeObject



16
17
18
19
20
21
22
# File 'lib/debugger/xml/extensions/commands/inspect.rb', line 16

def execute
  run_with_binding do |binding|
    obj = debug_eval(@match.post_match, binding)
    InspectCommand.reference_result(obj)
    print prv({eval_result: obj}, "local")
  end
end

#helpObject



24
25
26
27
28
# File 'lib/debugger/xml/extensions/commands/inspect.rb', line 24

def help
  %{
    v[ar] instpect <object>\tinpect a given object (supposed to be used only from ide)
  }
end

#regexpObject



12
13
14
# File 'lib/debugger/xml/extensions/commands/inspect.rb', line 12

def regexp
  /^\s*v(?:ar)?\s+inspect\s+/
end