Class: Pry::Command::Ls::Globals

Inherits:
Formatter show all
Defined in:
lib/pry/commands/ls/globals.rb

Constant Summary collapse

BUILTIN_GLOBALS =

Taken from “puts global_variables.inspect”.

%w[$" $$ $* $, $-0 $-F $-I $-K $-W $-a $-d $-i $-l $-p $-v $-w $. $/ $\\
$: $; $< $= $> $0 $ARGV $CONSOLE $DEBUG $DEFAULT_INPUT $DEFAULT_OUTPUT
$FIELD_SEPARATOR $FILENAME $FS $IGNORECASE $INPUT_LINE_NUMBER
$INPUT_RECORD_SEPARATOR $KCODE $LOADED_FEATURES $LOAD_PATH $NR $OFS
$ORS $OUTPUT_FIELD_SEPARATOR $OUTPUT_RECORD_SEPARATOR $PID $PROCESS_ID
$PROGRAM_NAME $RS $VERBOSE $deferr $defout $stderr $stdin $stdout].freeze
PSEUDO_GLOBALS =

‘$SAFE` and `$?` are thread-local, the exception stuff only works in a rescue clause, everything else is basically a local variable with a `$` in its name.

%w[$! $' $& $` $@ $? $+ $_ $~ $1 $2 $3 $4 $5 $6 $7 $8 $9
$CHILD_STATUS $SAFE $ERROR_INFO $ERROR_POSITION $LAST_MATCH_INFO
$LAST_PAREN_MATCH $LAST_READ_LINE $MATCH $POSTMATCH $PREMATCH].freeze

Instance Attribute Summary

Attributes inherited from Formatter

#pry_instance

Instance Method Summary collapse

Methods inherited from Formatter

#write_out

Constructor Details

#initialize(opts, pry_instance) ⇒ Globals

Returns a new instance of Globals.



24
25
26
27
# File 'lib/pry/commands/ls/globals.rb', line 24

def initialize(opts, pry_instance)
  super(pry_instance)
  @default_switch = opts[:globals]
end

Instance Method Details

#output_selfObject



29
30
31
32
# File 'lib/pry/commands/ls/globals.rb', line 29

def output_self
  variables = format(@target.eval('global_variables'))
  output_section('global variables', grep.regexp[variables])
end