如何增加binding.pry周围的行数?

How to increase the number of lines around binding.pry?

使用 gem pry-byebug,当我在某处添加 binding.pry 时,它只显示我所在行周围的 5 行:

    157:       max_bytes: limits_config.max_read_bytes_per_parser,
    158:       max_reads: limits_config.max_reads_per_parser,
    159:       max_seeks: limits_config.max_seeks_per_parser
    160:     )
    161:
 => 162:     results = parsers.lazy.map do |parser|
    163:       # Reset all the read limits, per parser
    164:       limited_io.reset_limits!
    165:       read_limiter_under_cache.reset_limits!
    166:
    167:       # We need to rewind for each parser, anew

有没有办法增加这个数字以显示更多代码行?

whereami 与指定行数的整数参数一起使用 return。

例如,给定文件 foo.rb:

# foo.rb

require 'pry'

def foo; end

def bar; end

def foobar
  # do something
  binding.pry
  # do something else
end

def baz; end

def foobarbaz; end

foobar

运行 它与 ruby foo.rb:

From: /Users/foo/foo.rb:11 Object#foobar:

     9: def foobar
    10:   # do something
 => 11:   binding.pry
    12:   # do something else
    13: end

⇒ 

并要求查看 +/- 10 行 whereami 10:

⇒ whereami 10

From: /Users/foo/foo.rb:11 Object#foobar:

     1: # foo.rb
     2:
     3: require 'pry'
     4:
     5: def foo; end
     6:
     7: def bar; end
     8:
     9: def foobar
    10:   # do something
 => 11:   binding.pry
    12:   # do something else
    13: end
    14:
    15: def baz; end
    16:
    17: def foobarbaz; end
    18:
    19: foobar

⇒ 

或者只有两行 whereami 1:

⇒ whereami 1

From: /Users/foo/foo.rb:11 Object#foobar:

    10:   # do something
 => 11:   binding.pry
    12:   # do something else

⇒