Sha256: 75375c85519653c23f325d365fdd68db93293228d05ebface87706f7a669183d

Contents?: true

Size: 1.23 KB

Versions: 6796

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

class Pry
  class Command
    class Ls < Pry::ClassCommand
      class Formatter
        attr_writer :grep
        attr_reader :pry_instance

        def initialize(pry_instance)
          @pry_instance = pry_instance
          @target = pry_instance.current_context
          @default_switch = nil
        end

        def write_out
          return false unless correct_opts?

          output_self
        end

        private

        def color(type, str)
          Pry::Helpers::Text.send pry_instance.config.ls.send("#{type}_color"), str
        end

        # Add a new section to the output.
        # Outputs nothing if the section would be empty.
        def output_section(heading, body)
          return '' if body.compact.empty?

          fancy_heading = Pry::Helpers::Text.bold(color(:heading, heading))
          Pry::Helpers.tablify_or_one_line(fancy_heading, body, @pry_instance)
        end

        def format_value(value)
          Pry::ColorPrinter.pp(value, ''.dup)
        end

        def correct_opts?
          @default_switch
        end

        def output_self
          raise NotImplementedError
        end

        def grep
          @grep || proc { |x| x }
        end
      end
    end
  end
end

Version data entries

6,796 entries across 6,792 versions & 31 rubygems

Version Path
cybrid_api_bank_ruby-0.123.132 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/ls/formatter.rb
cybrid_api_id_ruby-0.123.132 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/ls/formatter.rb
cybrid_api_organization_ruby-0.123.132 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/ls/formatter.rb
cybrid_api_bank_ruby-0.123.131 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/ls/formatter.rb
cybrid_api_id_ruby-0.123.131 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/ls/formatter.rb
cybrid_api_organization_ruby-0.123.131 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/ls/formatter.rb
cybrid_api_bank_ruby-0.123.129 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/ls/formatter.rb
cybrid_api_id_ruby-0.123.129 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/ls/formatter.rb
cybrid_api_organization_ruby-0.123.129 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/ls/formatter.rb
cybrid_api_bank_ruby-0.123.127 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/ls/formatter.rb
cybrid_api_id_ruby-0.123.127 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/ls/formatter.rb
cybrid_api_organization_ruby-0.123.127 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/ls/formatter.rb
cybrid_api_bank_ruby-0.123.126 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/ls/formatter.rb
cybrid_api_id_ruby-0.123.126 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/ls/formatter.rb
cybrid_api_organization_ruby-0.123.126 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/ls/formatter.rb
avalara_sdk-24.12.1 vendor/bundle/ruby/2.7.0/gems/pry-0.13.1/lib/pry/commands/ls/formatter.rb
cybrid_api_bank_ruby-0.123.125 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/ls/formatter.rb
cybrid_api_organization_ruby-0.123.125 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/ls/formatter.rb
cybrid_api_id_ruby-0.123.125 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/ls/formatter.rb
cybrid_api_bank_ruby-0.123.124 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/ls/formatter.rb