Class: Pry::Command::Ls::LsEntity

Inherits:
Object
  • Object
show all
Defined in:
lib/pry/commands/ls/ls_entity.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ LsEntity

Returns a new instance of LsEntity



17
18
19
20
21
22
23
24
# File 'lib/pry/commands/ls/ls_entity.rb', line 17

def initialize(opts)
  @interrogatee = opts[:interrogatee]
  @no_user_opts = opts[:no_user_opts]
  @opts = opts[:opts]
  @args = opts[:args]
  @grep = Grep.new(Regexp.new(opts[:opts][:G] || '.'))
  @_pry_ = opts.delete(:_pry_)
end

Instance Attribute Details

#_pry_Object (readonly)

Returns the value of attribute pry



15
16
17
# File 'lib/pry/commands/ls/ls_entity.rb', line 15

def _pry_
  @_pry_
end

Instance Method Details

#constantsObject (private)



40
41
42
# File 'lib/pry/commands/ls/ls_entity.rb', line 40

def constants
  grep Constants.new(@interrogatee, @no_user_opts, @opts, _pry_)
end

#entitiesObject (private)



64
65
66
67
# File 'lib/pry/commands/ls/ls_entity.rb', line 64

def entities
  [globals, constants, methods, self_methods, instance_vars, local_names,
    local_vars]
end

#entities_tableObject



26
27
28
# File 'lib/pry/commands/ls/ls_entity.rb', line 26

def entities_table
  entities.map(&:write_out).reject { |o| !o }.join('')
end

#globalsObject (private)



36
37
38
# File 'lib/pry/commands/ls/ls_entity.rb', line 36

def globals
  grep Globals.new(@opts, _pry_)
end

#grep(entity) ⇒ Object (private)



32
33
34
# File 'lib/pry/commands/ls/ls_entity.rb', line 32

def grep(entity)
  entity.tap { |o| o.grep = @grep }
end

#instance_varsObject (private)



52
53
54
# File 'lib/pry/commands/ls/ls_entity.rb', line 52

def instance_vars
  grep InstanceVars.new(@interrogatee, @no_user_opts, @opts, _pry_)
end

#local_namesObject (private)



56
57
58
# File 'lib/pry/commands/ls/ls_entity.rb', line 56

def local_names
  grep LocalNames.new(@no_user_opts, @args, _pry_)
end

#local_varsObject (private)



60
61
62
# File 'lib/pry/commands/ls/ls_entity.rb', line 60

def local_vars
  LocalVars.new(@opts, _pry_)
end

#methodsObject (private)



44
45
46
# File 'lib/pry/commands/ls/ls_entity.rb', line 44

def methods
  grep(Methods.new(@interrogatee, @no_user_opts, @opts, _pry_))
end

#self_methodsObject (private)



48
49
50
# File 'lib/pry/commands/ls/ls_entity.rb', line 48

def self_methods
  grep SelfMethods.new(@interrogatee, @no_user_opts, @opts, _pry_)
end