1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Refactor Pry::Method.from_str , because of comment on method_or_class_lookup in lib/pry/code_object.rb .

This commit is contained in:
yui-knk 2014-01-03 11:50:19 +09:00
parent 287f6b4670
commit c0da62be91
2 changed files with 1 additions and 7 deletions

View file

@ -112,12 +112,6 @@ class Pry
end
def method_or_class_lookup
# we need this here because stupid Pry::Method.from_str() does a
# 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?
obj = case str
when /\S+\(\)\z/
Pry::Method.from_str(str.sub(/\(\)\z/, ''),target) || Pry::WrappedModule.from_str(str, target)

View file

@ -43,7 +43,7 @@ class Pry
# method, or `nil` if no method could be located matching the parameters.
def from_str(name, target=TOPLEVEL_BINDING, options={})
if name.nil?
from_binding(target)
nil
elsif name.to_s =~ /(.+)\#(\S+)\Z/
context, meth_name = $1, $2
from_module(target.eval(context), meth_name, target)