diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/json/common.rb | 10 | ||||
-rw-r--r-- | lib/json/version.rb | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/json/common.rb b/lib/json/common.rb index 2f1584e..3ce25c1 100644 --- a/lib/json/common.rb +++ b/lib/json/common.rb @@ -33,12 +33,16 @@ module JSON # level (absolute namespace path?). If there doesn't exist a constant at # the given path, an ArgumentError is raised. def deep_const_get(path) # :nodoc: - path = path.to_s - path.split(/::/).inject(Object) do |p, c| + path.to_s.split(/::/).inject(Object) do |p, c| case when c.empty? then p when p.const_defined?(c) then p.const_get(c) - else raise ArgumentError, "can't find const #{path}" + else + if (c = p.const_missing(c) rescue nil) + c + else + raise ArgumentError, "can't find const #{path}" + end end end end diff --git a/lib/json/version.rb b/lib/json/version.rb index 571612e..a306929 100644 --- a/lib/json/version.rb +++ b/lib/json/version.rb @@ -1,6 +1,6 @@ module JSON # JSON version - VERSION = '1.2.3' + VERSION = '1.2.4' VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc: VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc: VERSION_MINOR = VERSION_ARRAY[1] # :nodoc: |