mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Show{Source,Doc}: refactor assuming definitions from the context
I hope you're pleased now, @banister!
This commit is contained in:
parent
c2be3f091f
commit
2d4dc78899
2 changed files with 2 additions and 11 deletions
|
@ -91,7 +91,7 @@ class Pry
|
||||||
# Pry::Method.from_binding when str is nil.
|
# Pry::Method.from_binding when str is nil.
|
||||||
# Once we refactor Pry::Method.from_str() so it doesnt lookup
|
# Once we refactor Pry::Method.from_str() so it doesnt lookup
|
||||||
# from bindings, we can get rid of this check
|
# from bindings, we can get rid of this check
|
||||||
return nil if str.to_s.empty?
|
return nil if str.to_s.empty? && super_level.zero?
|
||||||
|
|
||||||
obj = if str =~ /::(?:\S+)\Z/
|
obj = if str =~ /::(?:\S+)\Z/
|
||||||
Pry::WrappedModule.from_str(str,target) || Pry::Method.from_str(str, target)
|
Pry::WrappedModule.from_str(str,target) || Pry::Method.from_str(str, target)
|
||||||
|
|
|
@ -155,16 +155,7 @@ class Pry
|
||||||
end
|
end
|
||||||
|
|
||||||
def obj_name
|
def obj_name
|
||||||
@obj_name ||=
|
@obj_name ||= args.empty? ? nil : args.join(' ')
|
||||||
if args.empty? && (opts[:super] && opts[:super] > 0)
|
|
||||||
current_method_name
|
|
||||||
else
|
|
||||||
args.join(' ')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def current_method_name
|
|
||||||
_pry_.current_context.eval('::Kernel.__method__').to_s
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def use_line_numbers?
|
def use_line_numbers?
|
||||||
|
|
Loading…
Add table
Reference in a new issue