diff --git a/lib/pry/default_commands/context.rb b/lib/pry/default_commands/context.rb index 61dfa1b7..9f2b6535 100644 --- a/lib/pry/default_commands/context.rb +++ b/lib/pry/default_commands/context.rb @@ -24,7 +24,7 @@ class Pry 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__") diff --git a/lib/pry/method.rb b/lib/pry/method.rb index 3cd4150d..21290651 100644 --- a/lib/pry/method.rb +++ b/lib/pry/method.rb @@ -317,7 +317,7 @@ class Pry # @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`,