class Pry::Command::Ls::InstanceVars - pry-0.10.1 Documentation

# class Pry::Command::Ls::InstanceVars

### Public Class Methods

new(interrogatee, no_user_opts, opts, _pry_) click to toggle source
Calls superclass method Pry::Command::Ls::Formatter.new

    # File lib/pry/commands/ls/instance_vars.rb, line 8
    def initialize(interrogatee, no_user_opts, opts, _pry_)
      super(_pry_)
      @interrogatee = interrogatee
      @no_user_opts = no_user_opts
      @default_switch = opts[:ivars]
    end

### Public Instance Methods

correct_opts?() click to toggle source
Calls superclass method

    # File lib/pry/commands/ls/instance_vars.rb, line 15
    def correct_opts?
      super || @no_user_opts
    end

output_self() click to toggle source

    # File lib/pry/commands/ls/instance_vars.rb, line 19
    def output_self
      ivars = if Object === @interrogatee
                Pry::Method.safe_send(@interrogatee, :instance_variables)
              else
                [] #TODO: BasicObject support
              end
      kvars = Pry::Method.safe_send(interrogatee_mod, :class_variables)
      ivars_out = output_section('instance variables', format(:instance_var, ivars))
      kvars_out = output_section('class variables', format(:class_var, kvars))
      ivars_out + kvars_out
    end