1
0
Fork 0
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:
Kyrylo Silin 2013-05-03 23:42:19 +03:00
parent c2be3f091f
commit 2d4dc78899
2 changed files with 2 additions and 11 deletions

View file

@ -91,7 +91,7 @@ class Pry
# Pry::Method.from_binding when str is nil.
# Once we refactor Pry::Method.from_str() so it doesnt lookup
# 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/
Pry::WrappedModule.from_str(str,target) || Pry::Method.from_str(str, target)

View file

@ -155,16 +155,7 @@ class Pry
end
def obj_name
@obj_name ||=
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
@obj_name ||= args.empty? ? nil : args.join(' ')
end
def use_line_numbers?