Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix off-by-one error in Method#source_range

  • Loading branch information...
commit 71a30216fdae8fd720fc40b0d1304fac19e839d2 1 parent e0a28bb
@ConradIrwin ConradIrwin authored
Showing with 2 additions and 2 deletions.
  1. +1 −1  lib/pry/default_commands/context.rb
  2. +1 −1  lib/pry/method.rb
View
2  lib/pry/default_commands/context.rb
@@ -24,7 +24,7 @@ def process
if show_method?
file = @method.source_file
start = @method.source_range.begin
- finish = @method.source_range.end - 1
+ finish = @method.source_range.end
marker = target.eval("__LINE__")
else
file = target.eval("__FILE__")
View
2  lib/pry/method.rb
@@ -317,7 +317,7 @@ def source_line
# @return [Range, nil] The range of lines in `source_file` which contain
# the method's definition, or `nil` if that information is unavailable.
def source_range
- source_location.nil? ? nil : (source_line)...(source_line + source.lines.count)
+ source_location.nil? ? nil : (source_line)..(source_line + source.lines.count - 1)
end
# @return [Symbol] The visibility of the method. May be `:public`,
Please sign in to comment.
Something went wrong with that request. Please try again.