Sha256: 199a645f828b70697f9c6e8855bd623eacbb36816cabbbf8d96711f8551ee53a

Contents?: true

Size: 1.02 KB

Versions: 25

Compression:

Stored size: 1.02 KB

Contents

class Pry
  class Command::Ls < Pry::ClassCommand
    class Formatter
      attr_accessor :grep
      attr_reader :_pry_

      def initialize(_pry_)
        @_pry_ = _pry_
        @target = _pry_.current_context
      end

      def write_out
        return false unless correct_opts?
        output_self
      end

      private

      def color(type, str)
        Pry::Helpers::Text.send _pry_.config.ls["#{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)
      end

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

      def correct_opts?
        @default_switch
      end

      def output_self
        raise NotImplementedError
      end

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

    end
  end
end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
whos_dated_who-0.1.0 vendor/bundle/gems/pry-0.10.0/lib/pry/commands/ls/formatter.rb
whos_dated_who-0.0.1 vendor/bundle/gems/pry-0.10.0/lib/pry/commands/ls/formatter.rb
pry-0.10.0 lib/pry/commands/ls/formatter.rb
pry-0.10.0-i386-mswin32 lib/pry/commands/ls/formatter.rb
pry-0.10.0-i386-mingw32 lib/pry/commands/ls/formatter.rb
pry-0.10.0-x64-mingw32 lib/pry/commands/ls/formatter.rb
pry-0.10.0-java lib/pry/commands/ls/formatter.rb
pry-0.10.0.rc1 lib/pry/commands/ls/formatter.rb
pry-0.10.0.rc1-i386-mswin32 lib/pry/commands/ls/formatter.rb
pry-0.10.0.rc1-i386-mingw32 lib/pry/commands/ls/formatter.rb
pry-0.10.0.rc1-x64-mingw32 lib/pry/commands/ls/formatter.rb
pry-0.10.0.rc1-java lib/pry/commands/ls/formatter.rb
pry-0.10.0.pre4 lib/pry/commands/ls/formatter.rb
pry-0.10.0.pre4-i386-mswin32 lib/pry/commands/ls/formatter.rb
pry-0.10.0.pre4-i386-mingw32 lib/pry/commands/ls/formatter.rb
pry-0.10.0.pre4-x64-mingw32 lib/pry/commands/ls/formatter.rb
pry-0.10.0.pre4-java lib/pry/commands/ls/formatter.rb
pry-0.10.0.pre3 lib/pry/commands/ls/formatter.rb
pry-0.10.0.pre3-i386-mswin32 lib/pry/commands/ls/formatter.rb
pry-0.10.0.pre3-i386-mingw32 lib/pry/commands/ls/formatter.rb