From e69277e36a7004001408731eead8ce9f245d8aaa Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Thu, 8 Apr 2010 09:09:19 +0200 Subject: avoid superflous if --- lib/json/common.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/json') diff --git a/lib/json/common.rb b/lib/json/common.rb index a8aa016..244634b 100644 --- a/lib/json/common.rb +++ b/lib/json/common.rb @@ -38,9 +38,9 @@ module JSON when c.empty? then p when p.const_defined?(c) then p.const_get(c) else - if (c = p.const_missing(c) rescue nil) - c - else + begin + p.const_missing(c) + rescue NameError raise ArgumentError, "can't find const #{path}" end end -- cgit v1.2.1