Class: Pry::Command::Ls::LocalVars
- Defined in:
- lib/pry/commands/ls/local_vars.rb
Instance Attribute Summary
Attributes inherited from Formatter
Instance Method Summary collapse
-
#initialize(opts, _pry_) ⇒ LocalVars
constructor
A new instance of LocalVars.
- #output_self ⇒ Object
Methods inherited from Formatter
Constructor Details
#initialize(opts, _pry_) ⇒ LocalVars
Returns a new instance of LocalVars.
5 6 7 8 9 |
# File 'lib/pry/commands/ls/local_vars.rb', line 5 def initialize(opts, _pry_) super(_pry_) @default_switch = opts[:locals] @sticky_locals = _pry_.sticky_locals end |
Instance Method Details
#output_self ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/pry/commands/ls/local_vars.rb', line 11 def output_self name_value_pairs = @target.eval('local_variables').reject { |e| @sticky_locals.keys.include?(e.to_sym) }.map { |name| [name, (@target.eval(name.to_s))] } format(name_value_pairs).join('') end |