class Pry::Command::Ls::Globals
Constants
- BUILTIN_GLOBALS
Taken from “puts global_variables.inspect”.
- 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.
Public Class Methods
new(opts, _pry_)
click to toggle source
Calls superclass method
Pry::Command::Ls::Formatter::new
# File lib/pry/commands/ls/globals.rb, line 22 def initialize(opts, _pry_) super(_pry_) @default_switch = opts[:globals] end
Public Instance Methods
output_self()
click to toggle source
# 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
Private Instance Methods
format(globals)
click to toggle source
# File lib/pry/commands/ls/globals.rb, line 34 def format(globals) globals.map(&:to_s).sort_by(&:downcase).map do |name| if PSEUDO_GLOBALS.include?(name) color(:pseudo_global, name) elsif BUILTIN_GLOBALS.include?(name) color(:builtin_global, name) else color(:global_var, name) end end end