Sha256: 1fe36d7c704749622ef38224f7927bd4844404a415292a40e2b9a6370702b287

Contents?: true

Size: 1.64 KB

Versions: 15

Compression:

Stored size: 1.64 KB

Contents

require 'pry/commands/ls/grep'
require 'pry/commands/ls/formatter'
require 'pry/commands/ls/globals'
require 'pry/commands/ls/constants'
require 'pry/commands/ls/methods'
require 'pry/commands/ls/self_methods'
require 'pry/commands/ls/instance_vars'
require 'pry/commands/ls/local_names'
require 'pry/commands/ls/local_vars'

class Pry
  class Command::Ls < Pry::ClassCommand
    class LsEntity
      attr_reader :_pry_

      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

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

      private

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

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

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

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

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

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

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

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

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

Version data entries

15 entries across 15 versions & 7 rubygems

Version Path
argon-1.3.1 vendor/bundle/ruby/2.7.0/gems/pry-0.12.2/lib/pry/commands/ls/ls_entity.rb
symbolic_enum-1.1.5 vendor/bundle/ruby/2.7.0/gems/pry-0.12.2/lib/pry/commands/ls/ls_entity.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/pry-0.12.2/lib/pry/commands/ls/ls_entity.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/pry-0.12.2/lib/pry/commands/ls/ls_entity.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/pry-0.12.2/lib/pry/commands/ls/ls_entity.rb
chess_engine-0.0.2 vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/ls_entity.rb
chess_engine-0.0.1 vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/ls_entity.rb
alimentos-alu0100945645-0.1.0 vendor/bundle/ruby/2.3.0/gems/pry-0.12.2/lib/pry/commands/ls/ls_entity.rb
alimentos-alu0100945645-1.0.0 vendor/bundle/ruby/2.3.0/gems/pry-0.12.2/lib/pry/commands/ls/ls_entity.rb
pry-0.12.2-java lib/pry/commands/ls/ls_entity.rb
pry-0.12.2 lib/pry/commands/ls/ls_entity.rb
pry-0.12.1 lib/pry/commands/ls/ls_entity.rb
pry-0.12.1-java lib/pry/commands/ls/ls_entity.rb
pry-0.12.0 lib/pry/commands/ls/ls_entity.rb
pry-0.12.0-java lib/pry/commands/ls/ls_entity.rb