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)
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($! $' $& $` [email protected] $? $+ $_ $~ $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)

Instance Attribute Summary

Attributes inherited from Formatter

#_pry_

Instance Method Summary collapse

Methods inherited from Formatter

#write_out

Constructor Details

#initialize(opts, _pry_) ⇒ Globals

Returns a new instance of Globals


22
23
24
25
# File 'lib/pry/commands/ls/globals.rb', line 22

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

Instance Method Details

#output_selfObject


27
28
29
30
# File 'lib/pry/commands/ls/globals.rb', line 27

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