Browse files

avoid superflous if

  • Loading branch information...
1 parent a294a83 commit 207c895f1e28cfb12c846174fa99ae79575369b4 @flori flori committed Apr 8, 2010
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/json/common.rb
View
6 lib/json/common.rb
@@ -38,9 +38,9 @@ def deep_const_get(path) # :nodoc:
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

0 comments on commit 207c895

Please sign in to comment.