mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Fix off-by-one error in Method#source_range
This commit is contained in:
parent
e0a28bb5f8
commit
71a30216fd
2 changed files with 2 additions and 2 deletions
|
@ -24,7 +24,7 @@ class Pry
|
||||||
if show_method?
|
if show_method?
|
||||||
file = @method.source_file
|
file = @method.source_file
|
||||||
start = @method.source_range.begin
|
start = @method.source_range.begin
|
||||||
finish = @method.source_range.end - 1
|
finish = @method.source_range.end
|
||||||
marker = target.eval("__LINE__")
|
marker = target.eval("__LINE__")
|
||||||
else
|
else
|
||||||
file = target.eval("__FILE__")
|
file = target.eval("__FILE__")
|
||||||
|
|
|
@ -317,7 +317,7 @@ class Pry
|
||||||
# @return [Range, nil] The range of lines in `source_file` which contain
|
# @return [Range, nil] The range of lines in `source_file` which contain
|
||||||
# the method's definition, or `nil` if that information is unavailable.
|
# the method's definition, or `nil` if that information is unavailable.
|
||||||
def source_range
|
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
|
end
|
||||||
|
|
||||||
# @return [Symbol] The visibility of the method. May be `:public`,
|
# @return [Symbol] The visibility of the method. May be `:public`,
|
||||||
|
|
Loading…
Add table
Reference in a new issue