mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Pry::WrappedModule#source no longer raises if it can't find source.
This is not an exceptional situation so an exception should not be used. nil is now returned instead.
This commit is contained in:
parent
90f95688ca
commit
6e3800fa74
1 changed files with 2 additions and 2 deletions
|
@ -52,8 +52,8 @@ class Pry
|
|||
# @return [String] The source for the candidate, i.e the
|
||||
# complete module/class definition.
|
||||
def source
|
||||
return nil if file.nil?
|
||||
return @source if @source
|
||||
raise CommandError, "Could not locate source for #{wrapped}!" if file.nil?
|
||||
|
||||
@source = strip_leading_whitespace(Pry::Code.from_file(file).expression_at(line, number_of_lines_in_first_chunk))
|
||||
end
|
||||
|
@ -61,8 +61,8 @@ class Pry
|
|||
# @raise [Pry::CommandError] If documentation cannot be found.
|
||||
# @return [String] The documentation for the candidate.
|
||||
def doc
|
||||
return nil if file.nil?
|
||||
return @doc if @doc
|
||||
raise CommandError, "Could not locate doc for #{wrapped}!" if file.nil?
|
||||
|
||||
@doc = strip_leading_hash_and_whitespace_from_ruby_comments(Pry::Code.from_file(file).comment_describing(line))
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue