Class: Debugger::InspectCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/ruby-debug/commands/inspect.rb

Constant Summary collapse

@@references =

reference inspection results in order to save them from the GC

[]

Constants inherited from Command

Command::DEF_OPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

commands, #find, inherited, #initialize, load_commands, #match, method_missing, options

Constructor Details

This class inherits a constructor from Debugger::Command

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Debugger::Command

Class Method Details

.clear_referencesObject



9
10
11
# File 'lib/ruby-debug/commands/inspect.rb', line 9

def self.clear_references
  @@references = []
end

.reference_result(result) ⇒ Object



6
7
8
# File 'lib/ruby-debug/commands/inspect.rb', line 6

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

Instance Method Details

#executeObject



17
18
19
20
21
# File 'lib/ruby-debug/commands/inspect.rb', line 17

def execute
  obj = debug_eval(@match.post_match)
  InspectCommand.reference_result(obj)
  @printer.print_inspect(obj)
end

#regexpObject



13
14
15
# File 'lib/ruby-debug/commands/inspect.rb', line 13

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