From 4cf1d050348f7df14a22c96869bf90c18d58e502 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Wed, 11 Dec 2013 08:44:22 -0800 Subject: [PATCH] Simplify By putting the check for [] first, we don't need to handle the case where that's part of the method. --- lib/pry/method.rb | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/pry/method.rb b/lib/pry/method.rb index f413a70d..053d7614 100644 --- a/lib/pry/method.rb +++ b/lib/pry/method.rb @@ -47,17 +47,12 @@ class Pry elsif name.to_s =~ /(.+)\#(\S+)\Z/ context, meth_name = $1, $2 from_module(target.eval(context), meth_name, target) - elsif name.to_s =~ /(.+)(\.|::)(\S+)\Z/ - if($3 == "new[]") - name.to_s =~ /(.+)(\[\])\Z/ - context, meth_name = $1, $2 - else - context, meth_name = $1, $3 - end - from_obj(target.eval(context), meth_name, target) elsif name.to_s =~ /(.+)(\[\])\Z/ context, meth_name = $1, $2 from_obj(target.eval(context), meth_name, target) + elsif name.to_s =~ /(.+)(\.|::)(\S+)\Z/ + context, meth_name = $1, $3 + from_obj(target.eval(context), meth_name, target) elsif options[:instance] from_module(target.eval("self"), name, target) elsif options[:methods]