pry 0.9.11.4-i386-mswin32 → 0.9.12-i386-mswin32
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.
- data/.travis.yml +2 -0
 - data/CHANGELOG +19 -0
 - data/Rakefile +4 -0
 - data/lib/pry.rb +1 -1
 - data/lib/pry/cli.rb +14 -8
 - data/lib/pry/code.rb +3 -3
 - data/lib/pry/command.rb +20 -5
 - data/lib/pry/command_set.rb +3 -3
 - data/lib/pry/commands.rb +1 -1
 - data/lib/pry/commands/disabled_commands.rb +2 -0
 - data/lib/pry/commands/ls.rb +1 -2
 - data/lib/pry/commands/reload_code.rb +8 -1
 - data/lib/pry/commands/show_info.rb +66 -5
 - data/lib/pry/commands/show_source.rb +2 -1
 - data/lib/pry/commands/whereami.rb +87 -19
 - data/lib/pry/completion.rb +13 -4
 - data/lib/pry/helpers/base_helpers.rb +5 -2
 - data/lib/pry/helpers/command_helpers.rb +3 -1
 - data/lib/pry/helpers/documentation_helpers.rb +18 -7
 - data/lib/pry/helpers/table.rb +4 -4
 - data/lib/pry/indent.rb +2 -7
 - data/lib/pry/method.rb +89 -129
 - data/lib/pry/method/disowned.rb +53 -0
 - data/lib/pry/method/weird_method_locator.rb +186 -0
 - data/lib/pry/module_candidate.rb +13 -8
 - data/lib/pry/pager.rb +12 -11
 - data/lib/pry/plugins.rb +2 -0
 - data/lib/pry/pry_class.rb +19 -3
 - data/lib/pry/pry_instance.rb +3 -0
 - data/lib/pry/terminal.rb +78 -0
 - data/lib/pry/version.rb +1 -1
 - data/lib/pry/wrapped_module.rb +63 -1
 - data/spec/Procfile +3 -0
 - data/spec/command_helpers_spec.rb +21 -1
 - data/spec/commands/ls_spec.rb +4 -0
 - data/spec/commands/show_doc_spec.rb +255 -123
 - data/spec/commands/show_source_spec.rb +421 -236
 - data/spec/commands/whereami_spec.rb +60 -11
 - data/spec/completion_spec.rb +6 -0
 - data/spec/documentation_helper_spec.rb +73 -0
 - data/spec/fixtures/whereami_helper.rb +6 -0
 - data/spec/helpers/table_spec.rb +19 -0
 - data/spec/method_spec.rb +24 -7
 - metadata +12 -5
 - data/.gemtest +0 -0
 - data/lib/pry/commands/deprecated_commands.rb +0 -2
 - data/lib/pry/terminal_info.rb +0 -48
 
    
        data/.travis.yml
    CHANGED
    
    
    
        data/CHANGELOG
    CHANGED
    
    | 
         @@ -1,3 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            12/02/2012 version 0.9.12
         
     | 
| 
      
 2 
     | 
    
         
            +
            Bug fixes:
         
     | 
| 
      
 3 
     | 
    
         
            +
            * Fix major bug where commands broke due to slop looking at ARGV
         
     | 
| 
      
 4 
     | 
    
         
            +
            	instead of command parameters (#828)
         
     | 
| 
      
 5 
     | 
    
         
            +
            * Fix bug where pager broke in some situations (#845)
         
     | 
| 
      
 6 
     | 
    
         
            +
            * Fix broken rendering of some docs (#795)
         
     | 
| 
      
 7 
     | 
    
         
            +
            * silence warnings during failed tab-completion attempts
         
     | 
| 
      
 8 
     | 
    
         
            +
            * fix broken prompt when prompt is colored (#822 / #823)
         
     | 
| 
      
 9 
     | 
    
         
            +
            * added reload-method alias for reload-code (for backwards compat)
         
     | 
| 
      
 10 
     | 
    
         
            +
            * Reopen Readline.output if it is not a tty (see 1538bc0990)
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            Features:
         
     | 
| 
      
 13 
     | 
    
         
            +
            * added pry --gem (see 19bfc13aa)
         
     | 
| 
      
 14 
     | 
    
         
            +
            * show-source now works on commands created with create_command
         
     | 
| 
      
 15 
     | 
    
         
            +
            * add -m (method) -c (class) and -f (file) switches to 'whereami' command
         
     | 
| 
      
 16 
     | 
    
         
            +
            * show-source now falls back to superclass if can't find class code
         
     | 
| 
      
 17 
     | 
    
         
            +
            	(displays warning)
         
     | 
| 
      
 18 
     | 
    
         
            +
            * show-source/show-doc now indicate when -a option is available.
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
       1 
20 
     | 
    
         
             
            20/01/2012 version 0.9.11.4
         
     | 
| 
       2 
21 
     | 
    
         
             
            * fixed pager bug (wouldn't render color codes in some circumstances)
         
     | 
| 
       3 
22 
     | 
    
         
             
            * added Pry.last_internal_error, useful for devs debugging commands
         
     | 
    
        data/Rakefile
    CHANGED
    
    | 
         @@ -119,6 +119,8 @@ task :gems => [:clean, :rmgems, 'ruby:gem', 'mswin32:gem', 'mingw32:gem', 'jruby 
     | 
|
| 
       119 
119 
     | 
    
         | 
| 
       120 
120 
     | 
    
         
             
            desc "remove all platform gems"
         
     | 
| 
       121 
121 
     | 
    
         
             
            task :rmgems => ['ruby:clobber_package']
         
     | 
| 
      
 122 
     | 
    
         
            +
            task :rm_gems => :rmgems
         
     | 
| 
      
 123 
     | 
    
         
            +
            task :rm_pkgs => :rmgems
         
     | 
| 
       122 
124 
     | 
    
         | 
| 
       123 
125 
     | 
    
         
             
            desc "reinstall gem"
         
     | 
| 
       124 
126 
     | 
    
         
             
            task :reinstall => :gems do
         
     | 
| 
         @@ -126,6 +128,8 @@ task :reinstall => :gems do 
     | 
|
| 
       126 
128 
     | 
    
         
             
              sh "gem install #{File.dirname(__FILE__)}/pkg/pry-#{Pry::VERSION}.gem"
         
     | 
| 
       127 
129 
     | 
    
         
             
            end
         
     | 
| 
       128 
130 
     | 
    
         | 
| 
      
 131 
     | 
    
         
            +
            task :install => :reinstall
         
     | 
| 
      
 132 
     | 
    
         
            +
             
     | 
| 
       129 
133 
     | 
    
         
             
            desc "build and push latest gems"
         
     | 
| 
       130 
134 
     | 
    
         
             
            task :pushgems => :gems do
         
     | 
| 
       131 
135 
     | 
    
         
             
              chdir("#{File.dirname(__FILE__)}/pkg") do
         
     | 
    
        data/lib/pry.rb
    CHANGED
    
    
    
        data/lib/pry/cli.rb
    CHANGED
    
    | 
         @@ -99,10 +99,10 @@ Pry::CLI.add_options do 
     | 
|
| 
       99 
99 
     | 
    
         
             
              banner %{Usage: pry [OPTIONS]
         
     | 
| 
       100 
100 
     | 
    
         
             
            Start a Pry session.
         
     | 
| 
       101 
101 
     | 
    
         
             
            See: `https://github.com/pry` for more information.
         
     | 
| 
       102 
     | 
    
         
            -
            Copyright (c)  
     | 
| 
      
 102 
     | 
    
         
            +
            Copyright (c) 2013 John Mair (banisterfiend)
         
     | 
| 
       103 
103 
     | 
    
         
             
            --
         
     | 
| 
       104 
104 
     | 
    
         
             
            }
         
     | 
| 
       105 
     | 
    
         
            -
              on :e, :exec 
     | 
| 
      
 105 
     | 
    
         
            +
              on :e, :exec=, "A line of code to execute in context before the session starts" do |input|
         
     | 
| 
       106 
106 
     | 
    
         
             
                exec_string << input + "\n"
         
     | 
| 
       107 
107 
     | 
    
         
             
              end
         
     | 
| 
       108 
108 
     | 
    
         | 
| 
         @@ -123,12 +123,12 @@ Copyright (c) 2011 John Mair (banisterfiend) 
     | 
|
| 
       123 
123 
     | 
    
         
             
                Pry.config.should_load_local_rc = false
         
     | 
| 
       124 
124 
     | 
    
         
             
              end
         
     | 
| 
       125 
125 
     | 
    
         | 
| 
       126 
     | 
    
         
            -
              on :s, "select-plugin", "Only load specified plugin (and no others)." 
     | 
| 
      
 126 
     | 
    
         
            +
              on :s, "select-plugin=", "Only load specified plugin (and no others)." do |plugin_name|
         
     | 
| 
       127 
127 
     | 
    
         
             
                Pry.config.should_load_plugins = false
         
     | 
| 
       128 
128 
     | 
    
         
             
                Pry.plugins[plugin_name].activate!
         
     | 
| 
       129 
129 
     | 
    
         
             
              end
         
     | 
| 
       130 
130 
     | 
    
         | 
| 
       131 
     | 
    
         
            -
              on :d, "disable-plugin", "Disable a specific plugin." 
     | 
| 
      
 131 
     | 
    
         
            +
              on :d, "disable-plugin=", "Disable a specific plugin." do |plugin_name|
         
     | 
| 
       132 
132 
     | 
    
         
             
                Pry.plugins[plugin_name].disable!
         
     | 
| 
       133 
133 
     | 
    
         
             
              end
         
     | 
| 
       134 
134 
     | 
    
         | 
| 
         @@ -149,11 +149,11 @@ Copyright (c) 2011 John Mair (banisterfiend) 
     | 
|
| 
       149 
149 
     | 
    
         
             
                Pry.config.prompt = Pry::SIMPLE_PROMPT
         
     | 
| 
       150 
150 
     | 
    
         
             
              end
         
     | 
| 
       151 
151 
     | 
    
         | 
| 
       152 
     | 
    
         
            -
              on :r, :require 
     | 
| 
      
 152 
     | 
    
         
            +
              on :r, :require=, "`require` a Ruby script at startup" do |file|
         
     | 
| 
       153 
153 
     | 
    
         
             
                Pry.config.requires << file
         
     | 
| 
       154 
154 
     | 
    
         
             
              end
         
     | 
| 
       155 
155 
     | 
    
         | 
| 
       156 
     | 
    
         
            -
              on :I 
     | 
| 
      
 156 
     | 
    
         
            +
              on :I=, "Add a path to the $LOAD_PATH", :as => Array, :delimiter => ":" do |load_path|
         
     | 
| 
       157 
157 
     | 
    
         
             
                load_path.map! do |path|
         
     | 
| 
       158 
158 
     | 
    
         
             
                  /\A\.\// =~ path ? path : File.expand_path(path)
         
     | 
| 
       159 
159 
     | 
    
         
             
                end
         
     | 
| 
         @@ -161,14 +161,20 @@ Copyright (c) 2011 John Mair (banisterfiend) 
     | 
|
| 
       161 
161 
     | 
    
         
             
                $LOAD_PATH.unshift(*load_path)
         
     | 
| 
       162 
162 
     | 
    
         
             
              end
         
     | 
| 
       163 
163 
     | 
    
         | 
| 
      
 164 
     | 
    
         
            +
              on "gem", "Shorthand for -I./lib -rgemname" do |load_path|
         
     | 
| 
      
 165 
     | 
    
         
            +
                $LOAD_PATH.unshift("./lib")
         
     | 
| 
      
 166 
     | 
    
         
            +
                Dir["./lib/*.rb"].each do |file|
         
     | 
| 
      
 167 
     | 
    
         
            +
                  Pry.config.requires << file
         
     | 
| 
      
 168 
     | 
    
         
            +
                end
         
     | 
| 
      
 169 
     | 
    
         
            +
              end
         
     | 
| 
      
 170 
     | 
    
         
            +
             
     | 
| 
       164 
171 
     | 
    
         
             
              on :v, :version, "Display the Pry version" do
         
     | 
| 
       165 
172 
     | 
    
         
             
                puts "Pry version #{Pry::VERSION} on Ruby #{RUBY_VERSION}"
         
     | 
| 
       166 
173 
     | 
    
         
             
                exit
         
     | 
| 
       167 
174 
     | 
    
         
             
              end
         
     | 
| 
       168 
175 
     | 
    
         | 
| 
       169 
     | 
    
         
            -
              on(:c, :context 
     | 
| 
      
 176 
     | 
    
         
            +
              on(:c, :context=,
         
     | 
| 
       170 
177 
     | 
    
         
             
                 "Start the session in the specified context. Equivalent to `context.pry` in a session.",
         
     | 
| 
       171 
     | 
    
         
            -
                 :argument => true,
         
     | 
| 
       172 
178 
     | 
    
         
             
                 :default => "Pry.toplevel_binding"
         
     | 
| 
       173 
179 
     | 
    
         
             
                 )
         
     | 
| 
       174 
180 
     | 
    
         
             
            end.process_options do |opts|
         
     | 
    
        data/lib/pry/code.rb
    CHANGED
    
    | 
         @@ -84,12 +84,12 @@ class Pry 
     | 
|
| 
       84 
84 
     | 
    
         
             
                  # Attempt to extract the source code for module (or class) `mod`.
         
     | 
| 
       85 
85 
     | 
    
         
             
                  #
         
     | 
| 
       86 
86 
     | 
    
         
             
                  # @param [Module, Class] mod The module (or class) of interest.
         
     | 
| 
       87 
     | 
    
         
            -
                  # @param [Integer, nil] start_line The line number to start on, or nil to
         
     | 
| 
       88 
     | 
    
         
            -
                  #   use the method's original line numbers.
         
     | 
| 
       89 
87 
     | 
    
         
             
                  # @param [Integer] candidate_rank The module candidate (by rank)
         
     | 
| 
       90 
88 
     | 
    
         
             
                  #   to use (see `Pry::WrappedModule::Candidate` for more information).
         
     | 
| 
      
 89 
     | 
    
         
            +
                  # @param [Integer, nil] start_line The line number to start on, or nil to
         
     | 
| 
      
 90 
     | 
    
         
            +
                  #   use the method's original line numbers.
         
     | 
| 
       91 
91 
     | 
    
         
             
                  # @return [Code]
         
     | 
| 
       92 
     | 
    
         
            -
                  def from_module(mod,  
     | 
| 
      
 92 
     | 
    
         
            +
                  def from_module(mod, candidate_rank = 0, start_line=nil)
         
     | 
| 
       93 
93 
     | 
    
         
             
                    candidate = Pry::WrappedModule(mod).candidate(candidate_rank)
         
     | 
| 
       94 
94 
     | 
    
         
             
                    start_line ||= candidate.line
         
     | 
| 
       95 
95 
     | 
    
         
             
                    new(candidate.source, start_line, :ruby)
         
     | 
    
        data/lib/pry/command.rb
    CHANGED
    
    | 
         @@ -520,7 +520,7 @@ class Pry 
     | 
|
| 
       520 
520 
     | 
    
         
             
                  end
         
     | 
| 
       521 
521 
     | 
    
         | 
| 
       522 
522 
     | 
    
         
             
                  def source
         
     | 
| 
       523 
     | 
    
         
            -
                     
     | 
| 
      
 523 
     | 
    
         
            +
                    source_object.source
         
     | 
| 
       524 
524 
     | 
    
         
             
                  end
         
     | 
| 
       525 
525 
     | 
    
         | 
| 
       526 
526 
     | 
    
         
             
                  def doc
         
     | 
| 
         @@ -528,18 +528,33 @@ class Pry 
     | 
|
| 
       528 
528 
     | 
    
         
             
                  end
         
     | 
| 
       529 
529 
     | 
    
         | 
| 
       530 
530 
     | 
    
         
             
                  def source_location
         
     | 
| 
       531 
     | 
    
         
            -
                     
     | 
| 
      
 531 
     | 
    
         
            +
                    source_object.source_location
         
     | 
| 
       532 
532 
     | 
    
         
             
                  end
         
     | 
| 
       533 
533 
     | 
    
         | 
| 
       534 
534 
     | 
    
         
             
                  def source_file
         
     | 
| 
       535 
     | 
    
         
            -
                     
     | 
| 
      
 535 
     | 
    
         
            +
                    source_object.source_file
         
     | 
| 
       536 
536 
     | 
    
         
             
                  end
         
     | 
| 
       537 
537 
     | 
    
         
             
                  alias_method :file, :source_file
         
     | 
| 
       538 
538 
     | 
    
         | 
| 
       539 
539 
     | 
    
         
             
                  def source_line
         
     | 
| 
       540 
     | 
    
         
            -
                     
     | 
| 
      
 540 
     | 
    
         
            +
                    source_object.source_line
         
     | 
| 
       541 
541 
     | 
    
         
             
                  end
         
     | 
| 
       542 
542 
     | 
    
         
             
                  alias_method :line, :source_line
         
     | 
| 
      
 543 
     | 
    
         
            +
             
     | 
| 
      
 544 
     | 
    
         
            +
                  private
         
     | 
| 
      
 545 
     | 
    
         
            +
             
     | 
| 
      
 546 
     | 
    
         
            +
                  # The object used to extract the source for the command.
         
     | 
| 
      
 547 
     | 
    
         
            +
                  #
         
     | 
| 
      
 548 
     | 
    
         
            +
                  # This should be a `Pry::Method(block)` for a command made with `create_command`
         
     | 
| 
      
 549 
     | 
    
         
            +
                  # and a `Pry::WrappedModule(self)` for a command that's a standard class.
         
     | 
| 
      
 550 
     | 
    
         
            +
                  # @return [Pry::WrappedModule, Pry::Method]
         
     | 
| 
      
 551 
     | 
    
         
            +
                  def source_object
         
     | 
| 
      
 552 
     | 
    
         
            +
                    @source_object ||= if name =~ /^[A-Z]/
         
     | 
| 
      
 553 
     | 
    
         
            +
                                         Pry::WrappedModule(self)
         
     | 
| 
      
 554 
     | 
    
         
            +
                                       else
         
     | 
| 
      
 555 
     | 
    
         
            +
                                         Pry::Method(block)
         
     | 
| 
      
 556 
     | 
    
         
            +
                                       end
         
     | 
| 
      
 557 
     | 
    
         
            +
                  end
         
     | 
| 
       543 
558 
     | 
    
         
             
                end
         
     | 
| 
       544 
559 
     | 
    
         | 
| 
       545 
560 
     | 
    
         
             
                attr_accessor :opts
         
     | 
| 
         @@ -573,7 +588,7 @@ class Pry 
     | 
|
| 
       573 
588 
     | 
    
         
             
                # Return an instance of Slop that can parse either subcommands or the
         
     | 
| 
       574 
589 
     | 
    
         
             
                # options that this command accepts.
         
     | 
| 
       575 
590 
     | 
    
         
             
                def slop
         
     | 
| 
       576 
     | 
    
         
            -
                  Slop. 
     | 
| 
      
 591 
     | 
    
         
            +
                  Slop.new do |opt|
         
     | 
| 
       577 
592 
     | 
    
         
             
                    opt.banner(unindent(self.class.banner))
         
     | 
| 
       578 
593 
     | 
    
         
             
                    subcommands(opt)
         
     | 
| 
       579 
594 
     | 
    
         
             
                    options(opt)
         
     | 
    
        data/lib/pry/command_set.rb
    CHANGED
    
    | 
         @@ -263,13 +263,13 @@ class Pry 
     | 
|
| 
       263 
263 
     | 
    
         
             
                  commands.delete(cmd.match)
         
     | 
| 
       264 
264 
     | 
    
         
             
                end
         
     | 
| 
       265 
265 
     | 
    
         | 
| 
       266 
     | 
    
         
            -
                def  
     | 
| 
       267 
     | 
    
         
            -
                  create_command  
     | 
| 
      
 266 
     | 
    
         
            +
                def disabled_command(name_of_disabled_command, message, matcher=name_of_disabled_command)
         
     | 
| 
      
 267 
     | 
    
         
            +
                  create_command name_of_disabled_command do
         
     | 
| 
       268 
268 
     | 
    
         
             
                    match matcher
         
     | 
| 
       269 
269 
     | 
    
         
             
                    description ""
         
     | 
| 
       270 
270 
     | 
    
         | 
| 
       271 
271 
     | 
    
         
             
                    define_method(:process) do
         
     | 
| 
       272 
     | 
    
         
            -
                      output.puts " 
     | 
| 
      
 272 
     | 
    
         
            +
                      output.puts "DISABLED: #{message}"
         
     | 
| 
       273 
273 
     | 
    
         
             
                    end
         
     | 
| 
       274 
274 
     | 
    
         
             
                  end
         
     | 
| 
       275 
275 
     | 
    
         
             
                end
         
     | 
    
        data/lib/pry/commands.rb
    CHANGED
    
    
    
        data/lib/pry/commands/ls.rb
    CHANGED
    
    | 
         @@ -189,8 +189,7 @@ class Pry 
     | 
|
| 
       189 
189 
     | 
    
         
             
                  return unless opts.present?(:constants) || (!has_user_specified_any_options && interrogating_a_module?)
         
     | 
| 
       190 
190 
     | 
    
         | 
| 
       191 
191 
     | 
    
         
             
                  mod = interrogating_a_module? ? object_to_interrogate : Object
         
     | 
| 
       192 
     | 
    
         
            -
                  constants = mod.constants
         
     | 
| 
       193 
     | 
    
         
            -
                  constants -= (mod.ancestors - [mod]).map(&:constants).flatten unless opts.present?(:verbose)
         
     | 
| 
      
 192 
     | 
    
         
            +
                  constants = WrappedModule.new(mod).constants(opts.present?(:verbose))
         
     | 
| 
       194 
193 
     | 
    
         
             
                  output_section("constants", grep[format_constants(mod, constants)])
         
     | 
| 
       195 
194 
     | 
    
         
             
                end
         
     | 
| 
       196 
195 
     | 
    
         | 
| 
         @@ -6,6 +6,12 @@ class Pry 
     | 
|
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
                banner <<-'BANNER'
         
     | 
| 
       8 
8 
     | 
    
         
             
                  Reload the source file that contains the specified code object.
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  e.g reload-code MyClass#my_method    #=> reload a method
         
     | 
| 
      
 11 
     | 
    
         
            +
                      reload-code MyClass              #=> reload a class
         
     | 
| 
      
 12 
     | 
    
         
            +
                      reload-code my-command           #=> reload a pry command
         
     | 
| 
      
 13 
     | 
    
         
            +
                      reload-code self                 #=> reload the 'current' object
         
     | 
| 
      
 14 
     | 
    
         
            +
                      reload-code                      #=> identical to reload-code self
         
     | 
| 
       9 
15 
     | 
    
         
             
                BANNER
         
     | 
| 
       10 
16 
     | 
    
         | 
| 
       11 
17 
     | 
    
         
             
                def process
         
     | 
| 
         @@ -27,7 +33,7 @@ class Pry 
     | 
|
| 
       27 
33 
     | 
    
         
             
                end
         
     | 
| 
       28 
34 
     | 
    
         | 
| 
       29 
35 
     | 
    
         
             
                def check_for_reloadability(code_object)
         
     | 
| 
       30 
     | 
    
         
            -
                  if !code_object
         
     | 
| 
      
 36 
     | 
    
         
            +
                  if !code_object || !code_object.source_file
         
     | 
| 
       31 
37 
     | 
    
         
             
                    raise CommandError, "Cannot locate #{obj_name}!"
         
     | 
| 
       32 
38 
     | 
    
         
             
                  elsif !File.exists?(code_object.source_file)
         
     | 
| 
       33 
39 
     | 
    
         
             
                    raise CommandError, "Cannot reload #{obj_name} as it has no associated file on disk. File found was: #{code_object.source_file}"
         
     | 
| 
         @@ -36,4 +42,5 @@ class Pry 
     | 
|
| 
       36 
42 
     | 
    
         
             
              end
         
     | 
| 
       37 
43 
     | 
    
         | 
| 
       38 
44 
     | 
    
         
             
              Pry::Commands.add_command(Pry::Command::ReloadCode)
         
     | 
| 
      
 45 
     | 
    
         
            +
              Pry::Commands.alias_command 'reload-method', 'reload-code'
         
     | 
| 
       39 
46 
     | 
    
         
             
            end
         
     | 
| 
         @@ -13,28 +13,57 @@ class Pry 
     | 
|
| 
       13 
13 
     | 
    
         
             
                  opt.on :s, :super, "Select the 'super' method. Can be repeated to traverse the ancestors", :as => :count
         
     | 
| 
       14 
14 
     | 
    
         
             
                  opt.on :l, "line-numbers", "Show line numbers"
         
     | 
| 
       15 
15 
     | 
    
         
             
                  opt.on :b, "base-one", "Show line numbers but start numbering at 1 (useful for `amend-line` and `play` commands)"
         
     | 
| 
       16 
     | 
    
         
            -
                  opt.on :f, :flood, "Do not use a pager to view text longer than one screen"
         
     | 
| 
       17 
16 
     | 
    
         
             
                  opt.on :a, :all,   "Show all definitions and monkeypatches of the module/class"
         
     | 
| 
       18 
17 
     | 
    
         
             
                end
         
     | 
| 
       19 
18 
     | 
    
         | 
| 
       20 
19 
     | 
    
         
             
                def process
         
     | 
| 
       21 
20 
     | 
    
         
             
                  code_object = Pry::CodeObject.lookup(obj_name, _pry_, :super => opts[:super])
         
     | 
| 
       22 
     | 
    
         
            -
                  raise  
     | 
| 
      
 21 
     | 
    
         
            +
                  raise CommandError, no_definition_message if !code_object
         
     | 
| 
      
 22 
     | 
    
         
            +
                  @original_code_object = code_object
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
24 
     | 
    
         
             
                  if show_all_modules?(code_object)
         
     | 
| 
       25 
25 
     | 
    
         
             
                    # show all monkey patches for a module
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
       26 
27 
     | 
    
         
             
                    result = content_and_headers_for_all_module_candidates(code_object)
         
     | 
| 
       27 
28 
     | 
    
         
             
                  else
         
     | 
| 
       28 
29 
     | 
    
         
             
                    # show a specific code object
         
     | 
| 
       29 
     | 
    
         
            -
                     
     | 
| 
      
 30 
     | 
    
         
            +
                    co = code_object_with_accessible_source(code_object)
         
     | 
| 
      
 31 
     | 
    
         
            +
                    result = content_and_header_for_code_object(co)
         
     | 
| 
       30 
32 
     | 
    
         
             
                  end
         
     | 
| 
       31 
33 
     | 
    
         | 
| 
       32 
34 
     | 
    
         
             
                  set_file_and_dir_locals(code_object.source_file)
         
     | 
| 
       33 
35 
     | 
    
         
             
                  stagger_output result
         
     | 
| 
       34 
36 
     | 
    
         
             
                end
         
     | 
| 
       35 
37 
     | 
    
         | 
| 
      
 38 
     | 
    
         
            +
                # This method checks whether the `code_object` is a WrappedModule,
         
     | 
| 
      
 39 
     | 
    
         
            +
                # if it is, then it returns the first candidate (monkeypatch) with
         
     | 
| 
      
 40 
     | 
    
         
            +
                # accessible source (or docs). If `code_object` is not a WrappedModule (i.e a
         
     | 
| 
      
 41 
     | 
    
         
            +
                # method or a command) then the `code_object` itself is just
         
     | 
| 
      
 42 
     | 
    
         
            +
                # returned.
         
     | 
| 
      
 43 
     | 
    
         
            +
                #
         
     | 
| 
      
 44 
     | 
    
         
            +
                # @return [Pry::WrappedModule, Pry::Method, Pry::Command]
         
     | 
| 
      
 45 
     | 
    
         
            +
                def code_object_with_accessible_source(code_object)
         
     | 
| 
      
 46 
     | 
    
         
            +
                  if code_object.is_a?(WrappedModule)
         
     | 
| 
      
 47 
     | 
    
         
            +
                    candidate = code_object.candidates.find(&:source)
         
     | 
| 
      
 48 
     | 
    
         
            +
                    if candidate
         
     | 
| 
      
 49 
     | 
    
         
            +
                      return candidate
         
     | 
| 
      
 50 
     | 
    
         
            +
                    else
         
     | 
| 
      
 51 
     | 
    
         
            +
                      raise CommandError, no_definition_message if !valid_superclass?(code_object)
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                      @used_super = true
         
     | 
| 
      
 54 
     | 
    
         
            +
                      code_object_with_accessible_source(code_object.super)
         
     | 
| 
      
 55 
     | 
    
         
            +
                    end
         
     | 
| 
      
 56 
     | 
    
         
            +
                  else
         
     | 
| 
      
 57 
     | 
    
         
            +
                    code_object
         
     | 
| 
      
 58 
     | 
    
         
            +
                  end
         
     | 
| 
      
 59 
     | 
    
         
            +
                end
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
                def valid_superclass?(code_object)
         
     | 
| 
      
 62 
     | 
    
         
            +
                  code_object.super && code_object.super.wrapped != Object
         
     | 
| 
      
 63 
     | 
    
         
            +
                end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
       36 
65 
     | 
    
         
             
                def content_and_header_for_code_object(code_object)
         
     | 
| 
       37 
     | 
    
         
            -
                  header(code_object)  
     | 
| 
      
 66 
     | 
    
         
            +
                  header(code_object) + content_for(code_object)
         
     | 
| 
       38 
67 
     | 
    
         
             
                end
         
     | 
| 
       39 
68 
     | 
    
         | 
| 
       40 
69 
     | 
    
         
             
                def content_and_headers_for_all_module_candidates(mod)
         
     | 
| 
         @@ -54,14 +83,33 @@ class Pry 
     | 
|
| 
       54 
83 
     | 
    
         
             
                  result
         
     | 
| 
       55 
84 
     | 
    
         
             
                end
         
     | 
| 
       56 
85 
     | 
    
         | 
| 
      
 86 
     | 
    
         
            +
                def no_definition_message
         
     | 
| 
      
 87 
     | 
    
         
            +
                  "Couldn't locate a definition for #{obj_name}!"
         
     | 
| 
      
 88 
     | 
    
         
            +
                end
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
       57 
90 
     | 
    
         
             
                # Generate a header (meta-data information) for all the code
         
     | 
| 
       58 
91 
     | 
    
         
             
                # object types: methods, modules, commands, procs...
         
     | 
| 
       59 
92 
     | 
    
         
             
                def header(code_object)
         
     | 
| 
       60 
93 
     | 
    
         
             
                  file_name, line_num = file_and_line_for(code_object)
         
     | 
| 
       61 
94 
     | 
    
         
             
                  h = "\n#{Pry::Helpers::Text.bold('From:')} #{file_name} "
         
     | 
| 
       62 
     | 
    
         
            -
                  h <<  
     | 
| 
      
 95 
     | 
    
         
            +
                  h << code_object_header(code_object, line_num)
         
     | 
| 
       63 
96 
     | 
    
         
             
                  h << "\n#{Pry::Helpers::Text.bold('Number of lines:')} " <<
         
     | 
| 
       64 
97 
     | 
    
         
             
                    "#{content_for(code_object).lines.count}\n\n"
         
     | 
| 
      
 98 
     | 
    
         
            +
                  h << Helpers::Text.bold('** Warning:') + " Cannot find code for #{@original_code_object.nonblank_name}. Showing superclass #{code_object.nonblank_name} instead. **\n\n" if @used_super
         
     | 
| 
      
 99 
     | 
    
         
            +
                  h
         
     | 
| 
      
 100 
     | 
    
         
            +
                end
         
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
      
 102 
     | 
    
         
            +
                def code_object_header(code_object, line_num)
         
     | 
| 
      
 103 
     | 
    
         
            +
                  if code_object.real_method_object?
         
     | 
| 
      
 104 
     | 
    
         
            +
                    method_header(code_object, line_num)
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
                    # It sucks we have to test for both Pry::WrappedModule and WrappedModule::Candidate,
         
     | 
| 
      
 107 
     | 
    
         
            +
                    # probably indicates a deep refactor needs to happen in those classes.
         
     | 
| 
      
 108 
     | 
    
         
            +
                  elsif code_object.is_a?(Pry::WrappedModule) || code_object.is_a?(Pry::WrappedModule::Candidate)
         
     | 
| 
      
 109 
     | 
    
         
            +
                    module_header(code_object, line_num)
         
     | 
| 
      
 110 
     | 
    
         
            +
                  else
         
     | 
| 
      
 111 
     | 
    
         
            +
                    ""
         
     | 
| 
      
 112 
     | 
    
         
            +
                  end
         
     | 
| 
       65 
113 
     | 
    
         
             
                end
         
     | 
| 
       66 
114 
     | 
    
         | 
| 
       67 
115 
     | 
    
         
             
                def method_header(code_object, line_num)
         
     | 
| 
         @@ -73,6 +121,19 @@ class Pry 
     | 
|
| 
       73 
121 
     | 
    
         
             
                  h
         
     | 
| 
       74 
122 
     | 
    
         
             
                end
         
     | 
| 
       75 
123 
     | 
    
         | 
| 
      
 124 
     | 
    
         
            +
                def module_header(code_object, line_num)
         
     | 
| 
      
 125 
     | 
    
         
            +
                  h = ""
         
     | 
| 
      
 126 
     | 
    
         
            +
                  h << "@ line #{line_num}:\n"
         
     | 
| 
      
 127 
     | 
    
         
            +
                  h << text.bold(code_object.module? ? "Module" : "Class")
         
     | 
| 
      
 128 
     | 
    
         
            +
                  h << " #{text.bold('name:')} #{code_object.nonblank_name}"
         
     | 
| 
      
 129 
     | 
    
         
            +
             
     | 
| 
      
 130 
     | 
    
         
            +
                  if code_object.number_of_candidates > 1
         
     | 
| 
      
 131 
     | 
    
         
            +
                    h << (text.bold("\nNumber of monkeypatches: ") + code_object.number_of_candidates.to_s)
         
     | 
| 
      
 132 
     | 
    
         
            +
                    h << ". Use the `-a` option to display all available monkeypatches"
         
     | 
| 
      
 133 
     | 
    
         
            +
                  end
         
     | 
| 
      
 134 
     | 
    
         
            +
                  h
         
     | 
| 
      
 135 
     | 
    
         
            +
                end
         
     | 
| 
      
 136 
     | 
    
         
            +
             
     | 
| 
       76 
137 
     | 
    
         
             
                def method_sections(code_object)
         
     | 
| 
       77 
138 
     | 
    
         
             
                  {
         
     | 
| 
       78 
139 
     | 
    
         
             
                    :owner => "\n#{text.bold("Owner:")} #{code_object.owner || "N/A"}\n",
         
     | 
| 
         @@ -25,7 +25,8 @@ class Pry 
     | 
|
| 
       25 
25 
     | 
    
         | 
| 
       26 
26 
     | 
    
         
             
                # The source for code_object prepared for display.
         
     | 
| 
       27 
27 
     | 
    
         
             
                def content_for(code_object)
         
     | 
| 
       28 
     | 
    
         
            -
                   
     | 
| 
      
 28 
     | 
    
         
            +
                  cannot_locate_source_error if !code_object.source
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
       29 
30 
     | 
    
         
             
                  Code.new(code_object.source, start_line_for(code_object)).
         
     | 
| 
       30 
31 
     | 
    
         
             
                    with_line_numbers(use_line_numbers?).to_s
         
     | 
| 
       31 
32 
     | 
    
         
             
                end
         
     | 
| 
         @@ -1,16 +1,23 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            class Pry
         
     | 
| 
       2 
2 
     | 
    
         
             
              class Command::Whereami < Pry::ClassCommand
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
                class << self
         
     | 
| 
      
 5 
     | 
    
         
            +
                  attr_accessor :method_size_cutoff
         
     | 
| 
      
 6 
     | 
    
         
            +
                end
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                @method_size_cutoff = 30
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
       3 
10 
     | 
    
         
             
                match 'whereami'
         
     | 
| 
       4 
11 
     | 
    
         
             
                description 'Show code surrounding the current context.'
         
     | 
| 
       5 
12 
     | 
    
         
             
                group 'Context'
         
     | 
| 
       6 
13 
     | 
    
         | 
| 
       7 
14 
     | 
    
         
             
                banner <<-'BANNER'
         
     | 
| 
       8 
     | 
    
         
            -
                  Usage: whereami [-qn] [ 
     | 
| 
      
 15 
     | 
    
         
            +
                  Usage: whereami [-qn] [LINES]
         
     | 
| 
       9 
16 
     | 
    
         | 
| 
       10 
17 
     | 
    
         
             
                  Describe the current location. If you use `binding.pry` inside a method then
         
     | 
| 
       11 
18 
     | 
    
         
             
                  whereami will print out the source for that method.
         
     | 
| 
       12 
19 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
                  If a number is passed, then  
     | 
| 
      
 20 
     | 
    
         
            +
                  If a number is passed, then LINES lines before and after the current line will be
         
     | 
| 
       14 
21 
     | 
    
         
             
                  shown instead of the method itself.
         
     | 
| 
       15 
22 
     | 
    
         | 
| 
       16 
23 
     | 
    
         
             
                  The `-q` flag can be used to suppress error messages in the case that there's
         
     | 
| 
         @@ -25,29 +32,53 @@ class Pry 
     | 
|
| 
       25 
32 
     | 
    
         
             
                BANNER
         
     | 
| 
       26 
33 
     | 
    
         | 
| 
       27 
34 
     | 
    
         
             
                def setup
         
     | 
| 
       28 
     | 
    
         
            -
                  @ 
     | 
| 
       29 
     | 
    
         
            -
                  @file = target.eval('__FILE__')
         
     | 
| 
      
 35 
     | 
    
         
            +
                  @file = expand_path(target.eval('__FILE__'))
         
     | 
| 
       30 
36 
     | 
    
         
             
                  @line = target.eval('__LINE__')
         
     | 
| 
      
 37 
     | 
    
         
            +
                  @method = Pry::Method.from_binding(target)
         
     | 
| 
       31 
38 
     | 
    
         
             
                end
         
     | 
| 
       32 
39 
     | 
    
         | 
| 
       33 
40 
     | 
    
         
             
                def options(opt)
         
     | 
| 
       34 
41 
     | 
    
         
             
                  opt.on :q, :quiet,             "Don't display anything in case of an error"
         
     | 
| 
       35 
42 
     | 
    
         
             
                  opt.on :n, :"no-line-numbers", "Do not display line numbers"
         
     | 
| 
      
 43 
     | 
    
         
            +
                  opt.on :m, :"method", "Show the complete source for the current method."
         
     | 
| 
      
 44 
     | 
    
         
            +
                  opt.on :c, :"class", "Show the complete source for the current class or module."
         
     | 
| 
      
 45 
     | 
    
         
            +
                  opt.on :f, :"file", "Show the complete source for the current file."
         
     | 
| 
       36 
46 
     | 
    
         
             
                end
         
     | 
| 
       37 
47 
     | 
    
         | 
| 
       38 
48 
     | 
    
         
             
                def code
         
     | 
| 
       39 
     | 
    
         
            -
                  @code ||= if  
     | 
| 
       40 
     | 
    
         
            -
                               
     | 
| 
      
 49 
     | 
    
         
            +
                  @code ||= if opts.present?(:m)
         
     | 
| 
      
 50 
     | 
    
         
            +
                              method_code or raise CommandError, "Cannot find method code."
         
     | 
| 
      
 51 
     | 
    
         
            +
                            elsif opts.present?(:c)
         
     | 
| 
      
 52 
     | 
    
         
            +
                              class_code or raise CommandError, "Cannot find class code."
         
     | 
| 
      
 53 
     | 
    
         
            +
                            elsif opts.present?(:f)
         
     | 
| 
      
 54 
     | 
    
         
            +
                              Pry::Code.from_file(@file)
         
     | 
| 
      
 55 
     | 
    
         
            +
                            elsif args.any?
         
     | 
| 
      
 56 
     | 
    
         
            +
                              code_window
         
     | 
| 
       41 
57 
     | 
    
         
             
                            else
         
     | 
| 
       42 
     | 
    
         
            -
                               
     | 
| 
      
 58 
     | 
    
         
            +
                              default_code
         
     | 
| 
       43 
59 
     | 
    
         
             
                            end
         
     | 
| 
       44 
60 
     | 
    
         
             
                end
         
     | 
| 
       45 
61 
     | 
    
         | 
| 
      
 62 
     | 
    
         
            +
                def code?
         
     | 
| 
      
 63 
     | 
    
         
            +
                  !!code
         
     | 
| 
      
 64 
     | 
    
         
            +
                rescue MethodSource::SourceNotFoundError
         
     | 
| 
      
 65 
     | 
    
         
            +
                  false
         
     | 
| 
      
 66 
     | 
    
         
            +
                end
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                def bad_option_combination?
         
     | 
| 
      
 69 
     | 
    
         
            +
                  [opts.present?(:m), opts.present?(:f),
         
     | 
| 
      
 70 
     | 
    
         
            +
                   opts.present?(:c), args.any?].count(true) > 1
         
     | 
| 
      
 71 
     | 
    
         
            +
                end
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
       46 
73 
     | 
    
         
             
                def location
         
     | 
| 
       47 
74 
     | 
    
         
             
                  "#{@file} @ line #{@line} #{@method && @method.name_with_owner}"
         
     | 
| 
       48 
75 
     | 
    
         
             
                end
         
     | 
| 
       49 
76 
     | 
    
         | 
| 
       50 
77 
     | 
    
         
             
                def process
         
     | 
| 
      
 78 
     | 
    
         
            +
                  if bad_option_combination?
         
     | 
| 
      
 79 
     | 
    
         
            +
                    raise CommandError, "Only one of -m, -c, -f, and  LINES may be specified."
         
     | 
| 
      
 80 
     | 
    
         
            +
                  end
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
       51 
82 
     | 
    
         
             
                  if nothing_to_do?
         
     | 
| 
       52 
83 
     | 
    
         
             
                    return
         
     | 
| 
       53 
84 
     | 
    
         
             
                  elsif internal_binding?(target)
         
     | 
| 
         @@ -57,9 +88,10 @@ class Pry 
     | 
|
| 
       57 
88 
     | 
    
         | 
| 
       58 
89 
     | 
    
         
             
                  set_file_and_dir_locals(@file)
         
     | 
| 
       59 
90 
     | 
    
         | 
| 
       60 
     | 
    
         
            -
                   
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
      
 91 
     | 
    
         
            +
                  out = "\n#{text.bold('From:')} #{location}:\n\n" +
         
     | 
| 
      
 92 
     | 
    
         
            +
                    code.with_line_numbers(use_line_numbers?).with_marker(marker).to_s + "\n"
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
                  stagger_output(out)
         
     | 
| 
       63 
95 
     | 
    
         
             
                end
         
     | 
| 
       64 
96 
     | 
    
         | 
| 
       65 
97 
     | 
    
         
             
                private
         
     | 
| 
         @@ -88,17 +120,53 @@ class Pry 
     | 
|
| 
       88 
120 
     | 
    
         
             
                  end
         
     | 
| 
       89 
121 
     | 
    
         
             
                end
         
     | 
| 
       90 
122 
     | 
    
         | 
| 
       91 
     | 
    
         
            -
                def  
     | 
| 
       92 
     | 
    
         
            -
                   
     | 
| 
       93 
     | 
    
         
            -
                  # These checks are needed in case of an eval with a binding and file/line
         
     | 
| 
       94 
     | 
    
         
            -
                  # numbers set to outside the function. As in rails' use of ERB.
         
     | 
| 
       95 
     | 
    
         
            -
                  @method.source_file == @file && @method.source_range.include?(@line)
         
     | 
| 
      
 123 
     | 
    
         
            +
                def small_method?
         
     | 
| 
      
 124 
     | 
    
         
            +
                  @method.source_range.count < self.class.method_size_cutoff
         
     | 
| 
       96 
125 
     | 
    
         
             
                end
         
     | 
| 
       97 
126 
     | 
    
         | 
| 
       98 
     | 
    
         
            -
                def  
     | 
| 
       99 
     | 
    
         
            -
                   
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
       101 
     | 
    
         
            -
                   
     | 
| 
      
 127 
     | 
    
         
            +
                def default_code
         
     | 
| 
      
 128 
     | 
    
         
            +
                  if method_code && small_method?
         
     | 
| 
      
 129 
     | 
    
         
            +
                    method_code
         
     | 
| 
      
 130 
     | 
    
         
            +
                  else
         
     | 
| 
      
 131 
     | 
    
         
            +
                    code_window
         
     | 
| 
      
 132 
     | 
    
         
            +
                  end
         
     | 
| 
      
 133 
     | 
    
         
            +
                end
         
     | 
| 
      
 134 
     | 
    
         
            +
             
     | 
| 
      
 135 
     | 
    
         
            +
                def code_window
         
     | 
| 
      
 136 
     | 
    
         
            +
                  Pry::Code.from_file(@file).around(@line, window_size)
         
     | 
| 
      
 137 
     | 
    
         
            +
                end
         
     | 
| 
      
 138 
     | 
    
         
            +
             
     | 
| 
      
 139 
     | 
    
         
            +
                def method_code
         
     | 
| 
      
 140 
     | 
    
         
            +
                  return @method_code if @method_code
         
     | 
| 
      
 141 
     | 
    
         
            +
             
     | 
| 
      
 142 
     | 
    
         
            +
                  if valid_method?
         
     | 
| 
      
 143 
     | 
    
         
            +
                    @method_code = Pry::Code.from_method(@method)
         
     | 
| 
      
 144 
     | 
    
         
            +
                  end
         
     | 
| 
      
 145 
     | 
    
         
            +
                end
         
     | 
| 
      
 146 
     | 
    
         
            +
             
     | 
| 
      
 147 
     | 
    
         
            +
                def class_code
         
     | 
| 
      
 148 
     | 
    
         
            +
                  return @class_code if @class_code
         
     | 
| 
      
 149 
     | 
    
         
            +
             
     | 
| 
      
 150 
     | 
    
         
            +
                  if valid_method?
         
     | 
| 
      
 151 
     | 
    
         
            +
                    mod = Pry::WrappedModule(@method.owner)
         
     | 
| 
      
 152 
     | 
    
         
            +
                    idx = mod.candidates.find_index { |v| expand_path(v.source_file) == @file }
         
     | 
| 
      
 153 
     | 
    
         
            +
                    @class_code = idx && Pry::Code.from_module(mod, idx)
         
     | 
| 
      
 154 
     | 
    
         
            +
                  end
         
     | 
| 
      
 155 
     | 
    
         
            +
                end
         
     | 
| 
      
 156 
     | 
    
         
            +
             
     | 
| 
      
 157 
     | 
    
         
            +
                def valid_method?
         
     | 
| 
      
 158 
     | 
    
         
            +
                  @method && @method.source? && expand_path(@method.source_file) == @file &&
         
     | 
| 
      
 159 
     | 
    
         
            +
                    @method.source_range.include?(@line)
         
     | 
| 
      
 160 
     | 
    
         
            +
                end
         
     | 
| 
      
 161 
     | 
    
         
            +
             
     | 
| 
      
 162 
     | 
    
         
            +
                def expand_path(f)
         
     | 
| 
      
 163 
     | 
    
         
            +
                  return if !f
         
     | 
| 
      
 164 
     | 
    
         
            +
             
     | 
| 
      
 165 
     | 
    
         
            +
                  if Pry.eval_path == f
         
     | 
| 
      
 166 
     | 
    
         
            +
                    f
         
     | 
| 
      
 167 
     | 
    
         
            +
                  else
         
     | 
| 
      
 168 
     | 
    
         
            +
                    File.expand_path(f)
         
     | 
| 
      
 169 
     | 
    
         
            +
                  end
         
     | 
| 
       102 
170 
     | 
    
         
             
                end
         
     | 
| 
       103 
171 
     | 
    
         | 
| 
       104 
172 
     | 
    
         
             
                def window_size
         
     |