pry 0.10.0.pre2-universal-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/CHANGELOG.md +702 -0
 - data/LICENSE +25 -0
 - data/README.md +406 -0
 - data/bin/pry +16 -0
 - data/lib/pry.rb +161 -0
 - data/lib/pry/cli.rb +220 -0
 - data/lib/pry/code.rb +346 -0
 - data/lib/pry/code/code_file.rb +103 -0
 - data/lib/pry/code/code_range.rb +71 -0
 - data/lib/pry/code/loc.rb +92 -0
 - data/lib/pry/code_object.rb +172 -0
 - data/lib/pry/color_printer.rb +55 -0
 - data/lib/pry/command.rb +692 -0
 - data/lib/pry/command_set.rb +443 -0
 - data/lib/pry/commands.rb +6 -0
 - data/lib/pry/commands/amend_line.rb +99 -0
 - data/lib/pry/commands/bang.rb +20 -0
 - data/lib/pry/commands/bang_pry.rb +17 -0
 - data/lib/pry/commands/cat.rb +62 -0
 - data/lib/pry/commands/cat/abstract_formatter.rb +27 -0
 - data/lib/pry/commands/cat/exception_formatter.rb +77 -0
 - data/lib/pry/commands/cat/file_formatter.rb +67 -0
 - data/lib/pry/commands/cat/input_expression_formatter.rb +43 -0
 - data/lib/pry/commands/cd.rb +41 -0
 - data/lib/pry/commands/change_inspector.rb +27 -0
 - data/lib/pry/commands/change_prompt.rb +26 -0
 - data/lib/pry/commands/code_collector.rb +165 -0
 - data/lib/pry/commands/disable_pry.rb +27 -0
 - data/lib/pry/commands/disabled_commands.rb +2 -0
 - data/lib/pry/commands/easter_eggs.rb +112 -0
 - data/lib/pry/commands/edit.rb +195 -0
 - data/lib/pry/commands/edit/exception_patcher.rb +25 -0
 - data/lib/pry/commands/edit/file_and_line_locator.rb +36 -0
 - data/lib/pry/commands/exit.rb +42 -0
 - data/lib/pry/commands/exit_all.rb +29 -0
 - data/lib/pry/commands/exit_program.rb +23 -0
 - data/lib/pry/commands/find_method.rb +193 -0
 - data/lib/pry/commands/fix_indent.rb +19 -0
 - data/lib/pry/commands/gem_cd.rb +26 -0
 - data/lib/pry/commands/gem_install.rb +32 -0
 - data/lib/pry/commands/gem_list.rb +33 -0
 - data/lib/pry/commands/gem_open.rb +29 -0
 - data/lib/pry/commands/gist.rb +101 -0
 - data/lib/pry/commands/help.rb +164 -0
 - data/lib/pry/commands/hist.rb +180 -0
 - data/lib/pry/commands/import_set.rb +22 -0
 - data/lib/pry/commands/install_command.rb +53 -0
 - data/lib/pry/commands/jump_to.rb +29 -0
 - data/lib/pry/commands/list_inspectors.rb +35 -0
 - data/lib/pry/commands/list_prompts.rb +35 -0
 - data/lib/pry/commands/ls.rb +114 -0
 - data/lib/pry/commands/ls/constants.rb +47 -0
 - data/lib/pry/commands/ls/formatter.rb +49 -0
 - data/lib/pry/commands/ls/globals.rb +48 -0
 - data/lib/pry/commands/ls/grep.rb +21 -0
 - data/lib/pry/commands/ls/instance_vars.rb +39 -0
 - data/lib/pry/commands/ls/interrogatable.rb +18 -0
 - data/lib/pry/commands/ls/jruby_hacks.rb +49 -0
 - data/lib/pry/commands/ls/local_names.rb +35 -0
 - data/lib/pry/commands/ls/local_vars.rb +39 -0
 - data/lib/pry/commands/ls/ls_entity.rb +70 -0
 - data/lib/pry/commands/ls/methods.rb +57 -0
 - data/lib/pry/commands/ls/methods_helper.rb +46 -0
 - data/lib/pry/commands/ls/self_methods.rb +32 -0
 - data/lib/pry/commands/nesting.rb +25 -0
 - data/lib/pry/commands/play.rb +103 -0
 - data/lib/pry/commands/pry_backtrace.rb +25 -0
 - data/lib/pry/commands/pry_version.rb +17 -0
 - data/lib/pry/commands/raise_up.rb +32 -0
 - data/lib/pry/commands/reload_code.rb +62 -0
 - data/lib/pry/commands/reset.rb +18 -0
 - data/lib/pry/commands/ri.rb +60 -0
 - data/lib/pry/commands/save_file.rb +61 -0
 - data/lib/pry/commands/shell_command.rb +48 -0
 - data/lib/pry/commands/shell_mode.rb +25 -0
 - data/lib/pry/commands/show_doc.rb +83 -0
 - data/lib/pry/commands/show_info.rb +195 -0
 - data/lib/pry/commands/show_input.rb +17 -0
 - data/lib/pry/commands/show_source.rb +50 -0
 - data/lib/pry/commands/simple_prompt.rb +22 -0
 - data/lib/pry/commands/stat.rb +40 -0
 - data/lib/pry/commands/switch_to.rb +23 -0
 - data/lib/pry/commands/toggle_color.rb +24 -0
 - data/lib/pry/commands/watch_expression.rb +105 -0
 - data/lib/pry/commands/watch_expression/expression.rb +38 -0
 - data/lib/pry/commands/whereami.rb +190 -0
 - data/lib/pry/commands/wtf.rb +57 -0
 - data/lib/pry/config.rb +24 -0
 - data/lib/pry/config/behavior.rb +139 -0
 - data/lib/pry/config/convenience.rb +26 -0
 - data/lib/pry/config/default.rb +165 -0
 - data/lib/pry/core_extensions.rb +131 -0
 - data/lib/pry/editor.rb +133 -0
 - data/lib/pry/exceptions.rb +77 -0
 - data/lib/pry/helpers.rb +5 -0
 - data/lib/pry/helpers/base_helpers.rb +113 -0
 - data/lib/pry/helpers/command_helpers.rb +156 -0
 - data/lib/pry/helpers/documentation_helpers.rb +75 -0
 - data/lib/pry/helpers/options_helpers.rb +27 -0
 - data/lib/pry/helpers/table.rb +109 -0
 - data/lib/pry/helpers/text.rb +107 -0
 - data/lib/pry/history.rb +125 -0
 - data/lib/pry/history_array.rb +121 -0
 - data/lib/pry/hooks.rb +230 -0
 - data/lib/pry/indent.rb +406 -0
 - data/lib/pry/input_completer.rb +242 -0
 - data/lib/pry/input_lock.rb +132 -0
 - data/lib/pry/inspector.rb +27 -0
 - data/lib/pry/last_exception.rb +61 -0
 - data/lib/pry/method.rb +546 -0
 - data/lib/pry/method/disowned.rb +53 -0
 - data/lib/pry/method/patcher.rb +125 -0
 - data/lib/pry/method/weird_method_locator.rb +186 -0
 - data/lib/pry/module_candidate.rb +136 -0
 - data/lib/pry/object_path.rb +82 -0
 - data/lib/pry/output.rb +50 -0
 - data/lib/pry/pager.rb +234 -0
 - data/lib/pry/plugins.rb +103 -0
 - data/lib/pry/prompt.rb +26 -0
 - data/lib/pry/pry_class.rb +375 -0
 - data/lib/pry/pry_instance.rb +654 -0
 - data/lib/pry/rbx_path.rb +22 -0
 - data/lib/pry/repl.rb +202 -0
 - data/lib/pry/repl_file_loader.rb +74 -0
 - data/lib/pry/rubygem.rb +82 -0
 - data/lib/pry/terminal.rb +79 -0
 - data/lib/pry/test/helper.rb +170 -0
 - data/lib/pry/version.rb +3 -0
 - data/lib/pry/wrapped_module.rb +373 -0
 - metadata +248 -0
 
| 
         @@ -0,0 +1,35 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class Pry
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Command::Ls < Pry::ClassCommand
         
     | 
| 
      
 3 
     | 
    
         
            +
                class LocalNames < Pry::Command::Ls::Formatter
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                  def initialize(no_user_opts, args, _pry_)
         
     | 
| 
      
 6 
     | 
    
         
            +
                    super(_pry_)
         
     | 
| 
      
 7 
     | 
    
         
            +
                    @no_user_opts = no_user_opts
         
     | 
| 
      
 8 
     | 
    
         
            +
                    @args = args
         
     | 
| 
      
 9 
     | 
    
         
            +
                    @sticky_locals = _pry_.sticky_locals
         
     | 
| 
      
 10 
     | 
    
         
            +
                  end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                  def correct_opts?
         
     | 
| 
      
 13 
     | 
    
         
            +
                    super || (@no_user_opts && @args.empty?)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                  def output_self
         
     | 
| 
      
 17 
     | 
    
         
            +
                    local_vars = grep.regexp[@target.eval('local_variables')]
         
     | 
| 
      
 18 
     | 
    
         
            +
                    output_section('locals', format(local_vars))
         
     | 
| 
      
 19 
     | 
    
         
            +
                  end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  private
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                  def format(locals)
         
     | 
| 
      
 24 
     | 
    
         
            +
                    locals.sort_by(&:downcase).map do |name|
         
     | 
| 
      
 25 
     | 
    
         
            +
                      if @sticky_locals.include?(name.to_sym)
         
     | 
| 
      
 26 
     | 
    
         
            +
                        color(:pry_var, name)
         
     | 
| 
      
 27 
     | 
    
         
            +
                      else
         
     | 
| 
      
 28 
     | 
    
         
            +
                        color(:local_var, name)
         
     | 
| 
      
 29 
     | 
    
         
            +
                      end
         
     | 
| 
      
 30 
     | 
    
         
            +
                    end
         
     | 
| 
      
 31 
     | 
    
         
            +
                  end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
              end
         
     | 
| 
      
 35 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,39 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class Pry
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Command::Ls < Pry::ClassCommand
         
     | 
| 
      
 3 
     | 
    
         
            +
                class LocalVars < Pry::Command::Ls::Formatter
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                  def initialize(opts, _pry_)
         
     | 
| 
      
 6 
     | 
    
         
            +
                    super(_pry_)
         
     | 
| 
      
 7 
     | 
    
         
            +
                    @default_switch = opts[:locals]
         
     | 
| 
      
 8 
     | 
    
         
            +
                    @sticky_locals = _pry_.sticky_locals
         
     | 
| 
      
 9 
     | 
    
         
            +
                  end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                  def output_self
         
     | 
| 
      
 12 
     | 
    
         
            +
                    name_value_pairs = @target.eval('local_variables').reject { |e|
         
     | 
| 
      
 13 
     | 
    
         
            +
                      @sticky_locals.keys.include?(e.to_sym)
         
     | 
| 
      
 14 
     | 
    
         
            +
                    }.map { |name|
         
     | 
| 
      
 15 
     | 
    
         
            +
                      [name, (@target.eval(name.to_s))]
         
     | 
| 
      
 16 
     | 
    
         
            +
                    }
         
     | 
| 
      
 17 
     | 
    
         
            +
                    format(name_value_pairs).join('')
         
     | 
| 
      
 18 
     | 
    
         
            +
                  end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                  private
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                  def format(name_value_pairs)
         
     | 
| 
      
 23 
     | 
    
         
            +
                    name_value_pairs.sort_by { |name, value|
         
     | 
| 
      
 24 
     | 
    
         
            +
                      value.to_s.size
         
     | 
| 
      
 25 
     | 
    
         
            +
                    }.reverse.map { |name, value|
         
     | 
| 
      
 26 
     | 
    
         
            +
                      colorized_assignment_style(name, format_value(value))
         
     | 
| 
      
 27 
     | 
    
         
            +
                    }
         
     | 
| 
      
 28 
     | 
    
         
            +
                  end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                  def colorized_assignment_style(lhs, rhs, desired_width = 7)
         
     | 
| 
      
 31 
     | 
    
         
            +
                    colorized_lhs = color(:local_var, lhs)
         
     | 
| 
      
 32 
     | 
    
         
            +
                    color_escape_padding = colorized_lhs.size - lhs.size
         
     | 
| 
      
 33 
     | 
    
         
            +
                    pad = desired_width + color_escape_padding
         
     | 
| 
      
 34 
     | 
    
         
            +
                    "%-#{pad}s = %s" % [color(:local_var, colorized_lhs), rhs]
         
     | 
| 
      
 35 
     | 
    
         
            +
                  end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                end
         
     | 
| 
      
 38 
     | 
    
         
            +
              end
         
     | 
| 
      
 39 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,70 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'pry/commands/ls/grep'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'pry/commands/ls/formatter'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'pry/commands/ls/globals'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'pry/commands/ls/constants'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'pry/commands/ls/methods'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'pry/commands/ls/self_methods'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'pry/commands/ls/instance_vars'
         
     | 
| 
      
 8 
     | 
    
         
            +
            require 'pry/commands/ls/local_names'
         
     | 
| 
      
 9 
     | 
    
         
            +
            require 'pry/commands/ls/local_vars'
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            class Pry
         
     | 
| 
      
 12 
     | 
    
         
            +
              class Command::Ls < Pry::ClassCommand
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                class LsEntity
         
     | 
| 
      
 15 
     | 
    
         
            +
                  attr_reader :_pry_
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                  def initialize(opts)
         
     | 
| 
      
 18 
     | 
    
         
            +
                    @interrogatee = opts[:interrogatee]
         
     | 
| 
      
 19 
     | 
    
         
            +
                    @no_user_opts = opts[:no_user_opts]
         
     | 
| 
      
 20 
     | 
    
         
            +
                    @opts = opts[:opts]
         
     | 
| 
      
 21 
     | 
    
         
            +
                    @args = opts[:args]
         
     | 
| 
      
 22 
     | 
    
         
            +
                    @grep = Grep.new(Regexp.new(opts[:opts][:G] || '.'))
         
     | 
| 
      
 23 
     | 
    
         
            +
                    @_pry_ = opts.delete(:_pry_)
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                  def entities_table
         
     | 
| 
      
 27 
     | 
    
         
            +
                    entities.map(&:write_out).reject { |o| !o }.join('')
         
     | 
| 
      
 28 
     | 
    
         
            +
                  end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                  private
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                  def grep(entity)
         
     | 
| 
      
 33 
     | 
    
         
            +
                    entity.tap { |o| o.grep = @grep }
         
     | 
| 
      
 34 
     | 
    
         
            +
                  end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                  def globals
         
     | 
| 
      
 37 
     | 
    
         
            +
                    grep Globals.new(@opts, _pry_)
         
     | 
| 
      
 38 
     | 
    
         
            +
                  end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                  def constants
         
     | 
| 
      
 41 
     | 
    
         
            +
                    grep Constants.new(@interrogatee, @no_user_opts, @opts, _pry_)
         
     | 
| 
      
 42 
     | 
    
         
            +
                  end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                  def methods
         
     | 
| 
      
 45 
     | 
    
         
            +
                    grep(Methods.new(@interrogatee, @no_user_opts, @opts, _pry_))
         
     | 
| 
      
 46 
     | 
    
         
            +
                  end
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                  def self_methods
         
     | 
| 
      
 49 
     | 
    
         
            +
                    grep SelfMethods.new(@interrogatee, @no_user_opts, @opts, _pry_)
         
     | 
| 
      
 50 
     | 
    
         
            +
                  end
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                  def instance_vars
         
     | 
| 
      
 53 
     | 
    
         
            +
                    grep InstanceVars.new(@interrogatee, @no_user_opts, @opts, _pry_)
         
     | 
| 
      
 54 
     | 
    
         
            +
                  end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                  def local_names
         
     | 
| 
      
 57 
     | 
    
         
            +
                    grep LocalNames.new(@no_user_opts, @args, _pry_)
         
     | 
| 
      
 58 
     | 
    
         
            +
                  end
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                  def local_vars
         
     | 
| 
      
 61 
     | 
    
         
            +
                    LocalVars.new(@opts, _pry_)
         
     | 
| 
      
 62 
     | 
    
         
            +
                  end
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                  def entities
         
     | 
| 
      
 65 
     | 
    
         
            +
                    [globals, constants, methods, self_methods, instance_vars, local_names,
         
     | 
| 
      
 66 
     | 
    
         
            +
                      local_vars]
         
     | 
| 
      
 67 
     | 
    
         
            +
                  end
         
     | 
| 
      
 68 
     | 
    
         
            +
                end
         
     | 
| 
      
 69 
     | 
    
         
            +
              end
         
     | 
| 
      
 70 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,57 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'pry/commands/ls/methods_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'pry/commands/ls/interrogatable'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            class Pry
         
     | 
| 
      
 5 
     | 
    
         
            +
              class Command::Ls < Pry::ClassCommand
         
     | 
| 
      
 6 
     | 
    
         
            +
                class Methods < Pry::Command::Ls::Formatter
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                  include Pry::Command::Ls::Interrogatable
         
     | 
| 
      
 9 
     | 
    
         
            +
                  include Pry::Command::Ls::MethodsHelper
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                  def initialize(interrogatee, no_user_opts, opts, _pry_)
         
     | 
| 
      
 12 
     | 
    
         
            +
                    super(_pry_)
         
     | 
| 
      
 13 
     | 
    
         
            +
                    @interrogatee = interrogatee
         
     | 
| 
      
 14 
     | 
    
         
            +
                    @no_user_opts = no_user_opts
         
     | 
| 
      
 15 
     | 
    
         
            +
                    @default_switch = opts[:methods]
         
     | 
| 
      
 16 
     | 
    
         
            +
                    @instance_methods_switch = opts['instance-methods']
         
     | 
| 
      
 17 
     | 
    
         
            +
                    @ppp_switch = opts[:ppp]
         
     | 
| 
      
 18 
     | 
    
         
            +
                    @jruby_switch = opts['all-java']
         
     | 
| 
      
 19 
     | 
    
         
            +
                    @quiet_switch = opts[:quiet]
         
     | 
| 
      
 20 
     | 
    
         
            +
                    @verbose_switch = opts[:verbose]
         
     | 
| 
      
 21 
     | 
    
         
            +
                  end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                  def output_self
         
     | 
| 
      
 24 
     | 
    
         
            +
                    methods = all_methods.group_by(&:owner)
         
     | 
| 
      
 25 
     | 
    
         
            +
                    # Reverse the resolution order so that the most useful information
         
     | 
| 
      
 26 
     | 
    
         
            +
                    # appears right by the prompt.
         
     | 
| 
      
 27 
     | 
    
         
            +
                    resolution_order.take_while(&below_ceiling).reverse.map do |klass|
         
     | 
| 
      
 28 
     | 
    
         
            +
                      methods_here = (methods[klass] || []).select { |m| grep.regexp[m.name] }
         
     | 
| 
      
 29 
     | 
    
         
            +
                      heading = "#{ Pry::WrappedModule.new(klass).method_prefix }methods"
         
     | 
| 
      
 30 
     | 
    
         
            +
                      output_section(heading, format(methods_here))
         
     | 
| 
      
 31 
     | 
    
         
            +
                    end.join('')
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                  private
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                  def correct_opts?
         
     | 
| 
      
 37 
     | 
    
         
            +
                    super || @instance_methods_switch || @ppp_switch || @no_user_opts
         
     | 
| 
      
 38 
     | 
    
         
            +
                  end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                  # Get a lambda that can be used with `take_while` to prevent over-eager
         
     | 
| 
      
 42 
     | 
    
         
            +
                  # traversal of the Object's ancestry graph.
         
     | 
| 
      
 43 
     | 
    
         
            +
                  def below_ceiling
         
     | 
| 
      
 44 
     | 
    
         
            +
                    ceiling = if @quiet_switch
         
     | 
| 
      
 45 
     | 
    
         
            +
                                [Pry::Method.safe_send(interrogatee_mod, :ancestors)[1]] +
         
     | 
| 
      
 46 
     | 
    
         
            +
                                  _pry_.config.ls.ceiling
         
     | 
| 
      
 47 
     | 
    
         
            +
                              elsif @verbose_switch
         
     | 
| 
      
 48 
     | 
    
         
            +
                                []
         
     | 
| 
      
 49 
     | 
    
         
            +
                              else
         
     | 
| 
      
 50 
     | 
    
         
            +
                                _pry_.config.ls.ceiling.dup
         
     | 
| 
      
 51 
     | 
    
         
            +
                              end
         
     | 
| 
      
 52 
     | 
    
         
            +
                    lambda { |klass| !ceiling.include?(klass) }
         
     | 
| 
      
 53 
     | 
    
         
            +
                  end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                end
         
     | 
| 
      
 56 
     | 
    
         
            +
              end
         
     | 
| 
      
 57 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,46 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'pry/commands/ls/jruby_hacks'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Pry::Command::Ls::MethodsHelper
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
              include Pry::Command::Ls::JRubyHacks
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              private
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              # Get all the methods that we'll want to output.
         
     | 
| 
      
 10 
     | 
    
         
            +
              def all_methods(instance_methods = false)
         
     | 
| 
      
 11 
     | 
    
         
            +
                methods = if instance_methods || @instance_methods_switch
         
     | 
| 
      
 12 
     | 
    
         
            +
                            Pry::Method.all_from_class(@interrogatee)
         
     | 
| 
      
 13 
     | 
    
         
            +
                          else
         
     | 
| 
      
 14 
     | 
    
         
            +
                            Pry::Method.all_from_obj(@interrogatee)
         
     | 
| 
      
 15 
     | 
    
         
            +
                          end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                if Pry::Helpers::BaseHelpers.jruby? && !@jruby_switch
         
     | 
| 
      
 18 
     | 
    
         
            +
                  methods = trim_jruby_aliases(methods)
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                methods.select { |method| @ppp_switch || method.visibility == :public }
         
     | 
| 
      
 22 
     | 
    
         
            +
              end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
              def resolution_order
         
     | 
| 
      
 25 
     | 
    
         
            +
                if @instance_methods_switch
         
     | 
| 
      
 26 
     | 
    
         
            +
                  Pry::Method.instance_resolution_order(@interrogatee)
         
     | 
| 
      
 27 
     | 
    
         
            +
                else
         
     | 
| 
      
 28 
     | 
    
         
            +
                  Pry::Method.resolution_order(@interrogatee)
         
     | 
| 
      
 29 
     | 
    
         
            +
                end
         
     | 
| 
      
 30 
     | 
    
         
            +
              end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
              def format(methods)
         
     | 
| 
      
 33 
     | 
    
         
            +
                methods.sort_by(&:name).map do |method|
         
     | 
| 
      
 34 
     | 
    
         
            +
                  if method.name == 'method_missing'
         
     | 
| 
      
 35 
     | 
    
         
            +
                    color(:method_missing, 'method_missing')
         
     | 
| 
      
 36 
     | 
    
         
            +
                  elsif method.visibility == :private
         
     | 
| 
      
 37 
     | 
    
         
            +
                    color(:private_method, method.name)
         
     | 
| 
      
 38 
     | 
    
         
            +
                  elsif method.visibility == :protected
         
     | 
| 
      
 39 
     | 
    
         
            +
                    color(:protected_method, method.name)
         
     | 
| 
      
 40 
     | 
    
         
            +
                  else
         
     | 
| 
      
 41 
     | 
    
         
            +
                    color(:public_method, method.name)
         
     | 
| 
      
 42 
     | 
    
         
            +
                  end
         
     | 
| 
      
 43 
     | 
    
         
            +
                end
         
     | 
| 
      
 44 
     | 
    
         
            +
              end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,32 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'pry/commands/ls/interrogatable'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'pry/commands/ls/methods_helper'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            class Pry
         
     | 
| 
      
 5 
     | 
    
         
            +
              class Command::Ls < Pry::ClassCommand
         
     | 
| 
      
 6 
     | 
    
         
            +
                class SelfMethods < Pry::Command::Ls::Formatter
         
     | 
| 
      
 7 
     | 
    
         
            +
                  include Pry::Command::Ls::Interrogatable
         
     | 
| 
      
 8 
     | 
    
         
            +
                  include Pry::Command::Ls::MethodsHelper
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  def initialize(interrogatee, no_user_opts, opts, _pry_)
         
     | 
| 
      
 11 
     | 
    
         
            +
                    super(_pry_)
         
     | 
| 
      
 12 
     | 
    
         
            +
                    @interrogatee = interrogatee
         
     | 
| 
      
 13 
     | 
    
         
            +
                    @no_user_opts = no_user_opts
         
     | 
| 
      
 14 
     | 
    
         
            +
                  end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                  def output_self
         
     | 
| 
      
 17 
     | 
    
         
            +
                    methods = all_methods(true).select do |m|
         
     | 
| 
      
 18 
     | 
    
         
            +
                      m.owner == @interrogatee && grep.regexp[m.name]
         
     | 
| 
      
 19 
     | 
    
         
            +
                    end
         
     | 
| 
      
 20 
     | 
    
         
            +
                    heading = "#{ Pry::WrappedModule.new(@interrogatee).method_prefix }methods"
         
     | 
| 
      
 21 
     | 
    
         
            +
                    output_section(heading, format(methods))
         
     | 
| 
      
 22 
     | 
    
         
            +
                  end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                  private
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                  def correct_opts?
         
     | 
| 
      
 27 
     | 
    
         
            +
                    @no_user_opts && interrogating_a_module?
         
     | 
| 
      
 28 
     | 
    
         
            +
                  end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                end
         
     | 
| 
      
 31 
     | 
    
         
            +
              end
         
     | 
| 
      
 32 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class Pry
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Command::Nesting < Pry::ClassCommand
         
     | 
| 
      
 3 
     | 
    
         
            +
                match 'nesting'
         
     | 
| 
      
 4 
     | 
    
         
            +
                group 'Navigating Pry'
         
     | 
| 
      
 5 
     | 
    
         
            +
                description 'Show nesting information.'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                banner <<-'BANNER'
         
     | 
| 
      
 8 
     | 
    
         
            +
                  Show nesting information.
         
     | 
| 
      
 9 
     | 
    
         
            +
                BANNER
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                def process
         
     | 
| 
      
 12 
     | 
    
         
            +
                  output.puts 'Nesting status:'
         
     | 
| 
      
 13 
     | 
    
         
            +
                  output.puts '--'
         
     | 
| 
      
 14 
     | 
    
         
            +
                  _pry_.binding_stack.each_with_index do |obj, level|
         
     | 
| 
      
 15 
     | 
    
         
            +
                    if level == 0
         
     | 
| 
      
 16 
     | 
    
         
            +
                      output.puts "#{level}. #{Pry.view_clip(obj.eval('self'))} (Pry top level)"
         
     | 
| 
      
 17 
     | 
    
         
            +
                    else
         
     | 
| 
      
 18 
     | 
    
         
            +
                      output.puts "#{level}. #{Pry.view_clip(obj.eval('self'))}"
         
     | 
| 
      
 19 
     | 
    
         
            +
                    end
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
              end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
              Pry::Commands.add_command(Pry::Command::Nesting)
         
     | 
| 
      
 25 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,103 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class Pry
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Command::Play < Pry::ClassCommand
         
     | 
| 
      
 3 
     | 
    
         
            +
                match 'play'
         
     | 
| 
      
 4 
     | 
    
         
            +
                group 'Editing'
         
     | 
| 
      
 5 
     | 
    
         
            +
                description 'Playback a string variable, method, line, or file as input.'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                banner <<-'BANNER'
         
     | 
| 
      
 8 
     | 
    
         
            +
                  Usage: play [OPTIONS] [--help]
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  The play command enables you to replay code from files and methods as if they
         
     | 
| 
      
 11 
     | 
    
         
            +
                  were entered directly in the Pry REPL.
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                  play --lines 149..153   # assumes current context
         
     | 
| 
      
 14 
     | 
    
         
            +
                  play -i 20 --lines 1..3 # assumes lines of the input expression at 20
         
     | 
| 
      
 15 
     | 
    
         
            +
                  play -o 4               # the output of of an expression at 4
         
     | 
| 
      
 16 
     | 
    
         
            +
                  play Pry#repl -l 1..-1  # play the contents of Pry#repl method
         
     | 
| 
      
 17 
     | 
    
         
            +
                  play -e 2               # play from specified line until end of valid expression
         
     | 
| 
      
 18 
     | 
    
         
            +
                  play hello.rb           # play a file
         
     | 
| 
      
 19 
     | 
    
         
            +
                  play Rakefile -l 5      # play line 5 of a file
         
     | 
| 
      
 20 
     | 
    
         
            +
                  play -d hi              # play documentation of hi method
         
     | 
| 
      
 21 
     | 
    
         
            +
                  play hi --open          # play hi method and leave it open
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                  https://github.com/pry/pry/wiki/User-Input#wiki-Play
         
     | 
| 
      
 24 
     | 
    
         
            +
                BANNER
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                def options(opt)
         
     | 
| 
      
 27 
     | 
    
         
            +
                  CodeCollector.inject_options(opt)
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                  opt.on :open, 'Plays the selected content except the last line. Useful' \
         
     | 
| 
      
 30 
     | 
    
         
            +
                                ' for replaying methods and leaving the method definition' \
         
     | 
| 
      
 31 
     | 
    
         
            +
                                ' "open". `amend-line` can then be used to' \
         
     | 
| 
      
 32 
     | 
    
         
            +
                                ' modify the method.'
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                  opt.on :e, :expression=, 'Executes until end of valid expression', :as => Integer
         
     | 
| 
      
 35 
     | 
    
         
            +
                  opt.on :p, :print, 'Prints executed code'
         
     | 
| 
      
 36 
     | 
    
         
            +
                end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                def process
         
     | 
| 
      
 39 
     | 
    
         
            +
                  @cc = CodeCollector.new(args, opts, _pry_)
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                  perform_play
         
     | 
| 
      
 42 
     | 
    
         
            +
                  show_input
         
     | 
| 
      
 43 
     | 
    
         
            +
                end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                def perform_play
         
     | 
| 
      
 46 
     | 
    
         
            +
                  eval_string << content_after_options
         
     | 
| 
      
 47 
     | 
    
         
            +
                  run "fix-indent"
         
     | 
| 
      
 48 
     | 
    
         
            +
                end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                def show_input
         
     | 
| 
      
 51 
     | 
    
         
            +
                  if opts.present?(:print) or !Pry::Code.complete_expression?(eval_string)
         
     | 
| 
      
 52 
     | 
    
         
            +
                    run "show-input"
         
     | 
| 
      
 53 
     | 
    
         
            +
                  end
         
     | 
| 
      
 54 
     | 
    
         
            +
                end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                def content_after_options
         
     | 
| 
      
 58 
     | 
    
         
            +
                  if opts.present?(:open)
         
     | 
| 
      
 59 
     | 
    
         
            +
                    restrict_to_lines(content, (0..-2))
         
     | 
| 
      
 60 
     | 
    
         
            +
                  elsif opts.present?(:expression)
         
     | 
| 
      
 61 
     | 
    
         
            +
                    content_at_expression
         
     | 
| 
      
 62 
     | 
    
         
            +
                  else
         
     | 
| 
      
 63 
     | 
    
         
            +
                    content
         
     | 
| 
      
 64 
     | 
    
         
            +
                  end
         
     | 
| 
      
 65 
     | 
    
         
            +
                end
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
                def content_at_expression
         
     | 
| 
      
 68 
     | 
    
         
            +
                  code_object.expression_at(opts[:expression])
         
     | 
| 
      
 69 
     | 
    
         
            +
                end
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                def code_object
         
     | 
| 
      
 72 
     | 
    
         
            +
                  Pry::Code.new(content)
         
     | 
| 
      
 73 
     | 
    
         
            +
                end
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
                def should_use_default_file?
         
     | 
| 
      
 76 
     | 
    
         
            +
                  !args.first && !opts.present?(:in) && !opts.present?(:out)
         
     | 
| 
      
 77 
     | 
    
         
            +
                end
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
                def content
         
     | 
| 
      
 80 
     | 
    
         
            +
                  if should_use_default_file?
         
     | 
| 
      
 81 
     | 
    
         
            +
                    file_content
         
     | 
| 
      
 82 
     | 
    
         
            +
                  else
         
     | 
| 
      
 83 
     | 
    
         
            +
                    @cc.content
         
     | 
| 
      
 84 
     | 
    
         
            +
                  end
         
     | 
| 
      
 85 
     | 
    
         
            +
                end
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
                # The file to play from when no code object is specified.
         
     | 
| 
      
 88 
     | 
    
         
            +
                # e.g `play --lines 4..10`
         
     | 
| 
      
 89 
     | 
    
         
            +
                def default_file
         
     | 
| 
      
 90 
     | 
    
         
            +
                  target.eval("__FILE__") && File.expand_path(target.eval("__FILE__"))
         
     | 
| 
      
 91 
     | 
    
         
            +
                end
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
                def file_content
         
     | 
| 
      
 94 
     | 
    
         
            +
                  if default_file && File.exists?(default_file)
         
     | 
| 
      
 95 
     | 
    
         
            +
                    @cc.restrict_to_lines(File.read(default_file), @cc.line_range)
         
     | 
| 
      
 96 
     | 
    
         
            +
                  else
         
     | 
| 
      
 97 
     | 
    
         
            +
                    raise CommandError, "File does not exist! File was: #{default_file.inspect}"
         
     | 
| 
      
 98 
     | 
    
         
            +
                  end
         
     | 
| 
      
 99 
     | 
    
         
            +
                end
         
     | 
| 
      
 100 
     | 
    
         
            +
              end
         
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
      
 102 
     | 
    
         
            +
              Pry::Commands.add_command(Pry::Command::Play)
         
     | 
| 
      
 103 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class Pry
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Command::PryBacktrace < Pry::ClassCommand
         
     | 
| 
      
 3 
     | 
    
         
            +
                match 'pry-backtrace'
         
     | 
| 
      
 4 
     | 
    
         
            +
                group 'Context'
         
     | 
| 
      
 5 
     | 
    
         
            +
                description 'Show the backtrace for the Pry session.'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                banner <<-BANNER
         
     | 
| 
      
 8 
     | 
    
         
            +
                  Usage: pry-backtrace [OPTIONS] [--help]
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  Show the backtrace for the position in the code where Pry was started. This can
         
     | 
| 
      
 11 
     | 
    
         
            +
                  be used to infer the behavior of the program immediately before it entered Pry,
         
     | 
| 
      
 12 
     | 
    
         
            +
                  just like the backtrace property of an exception.
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  NOTE: if you are looking for the backtrace of the most recent exception raised,
         
     | 
| 
      
 15 
     | 
    
         
            +
                  just type: `_ex_.backtrace` instead.
         
     | 
| 
      
 16 
     | 
    
         
            +
                  See: https://github.com/pry/pry/wiki/Special-Locals
         
     | 
| 
      
 17 
     | 
    
         
            +
                BANNER
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                def process
         
     | 
| 
      
 20 
     | 
    
         
            +
                  _pry_.pager.page text.bold('Backtrace:') << "\n--\n" << _pry_.backtrace.join("\n")
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
              end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
              Pry::Commands.add_command(Pry::Command::PryBacktrace)
         
     | 
| 
      
 25 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,17 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class Pry
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Command::Version < Pry::ClassCommand
         
     | 
| 
      
 3 
     | 
    
         
            +
                match 'pry-version'
         
     | 
| 
      
 4 
     | 
    
         
            +
                group 'Misc'
         
     | 
| 
      
 5 
     | 
    
         
            +
                description 'Show Pry version.'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                banner <<-'BANNER'
         
     | 
| 
      
 8 
     | 
    
         
            +
                  Show Pry version.
         
     | 
| 
      
 9 
     | 
    
         
            +
                BANNER
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                def process
         
     | 
| 
      
 12 
     | 
    
         
            +
                  output.puts "Pry version: #{Pry::VERSION} on Ruby #{RUBY_VERSION}."
         
     | 
| 
      
 13 
     | 
    
         
            +
                end
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              Pry::Commands.add_command(Pry::Command::Version)
         
     | 
| 
      
 17 
     | 
    
         
            +
            end
         
     |