Pry::Method.from_str() can no longer raise an exception
/cc @ryanf the following used to cause exceptions: Pry::Method.from_str("NonexistentClass#method", binding) I just wrapped from_str in a rescue Pry::RescuableException
This commit is contained in:
parent
7ecb425fba
commit
5f3129f44b
|
@ -54,6 +54,9 @@ class Pry
|
|||
from_str(name, target, :instance => true) or
|
||||
from_str(name, target, :methods => true)
|
||||
end
|
||||
|
||||
rescue Pry::RescuableException
|
||||
nil
|
||||
end
|
||||
|
||||
# Given a `Binding`, try to extract the `::Method` it originated from and
|
||||
|
|
|
@ -79,6 +79,10 @@ describe Pry::Method do
|
|||
meth = Pry::Method.from_str("klass::meth", Pry.binding_for(binding))
|
||||
meth.name.should == "meth"
|
||||
end
|
||||
|
||||
it 'should not raise an exception if receiver does not exist' do
|
||||
lambda { Pry::Method.from_str("random_klass.meth", Pry.binding_for(binding)) }.should.not.raise
|
||||
end
|
||||
end
|
||||
|
||||
describe '.from_binding' do
|
||||
|
@ -459,4 +463,3 @@ describe Pry::Method do
|
|||
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue