Class: Pry::Command::Ls::LocalVars

Inherits:
Formatter show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/commands/ls/local_vars.rb

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) ⇒ LocalVars

Returns a new instance of LocalVars.



7
8
9
10
11
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/commands/ls/local_vars.rb', line 7

def initialize(opts, pry_instance)
  super(pry_instance)
  @default_switch = opts[:locals]
  @sticky_locals = pry_instance.sticky_locals
end

Instance Method Details

#output_selfObject



13
14
15
16
17
18
19
20
21
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/commands/ls/local_vars.rb', line 13

def output_self
  locals = @target.eval('local_variables').reject do |e|
    @sticky_locals.key?(e.to_sym)
  end
  name_value_pairs = locals.map do |name|
    [name, @target.eval(name.to_s)]
  end
  format(name_value_pairs).join('')
end