diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-28 09:22:57 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-28 09:22:57 +0000 |
commit | 0cf0b824182fc643c4e295b7178b84e71fdded54 (patch) | |
tree | f8eb0bb1ca3effb41119a9e505395f6ba8003752 /lib/json/pure | |
parent | 6272cf8ecd8f4cd35af10aecf505f22b8244c56d (diff) | |
download | ruby-0cf0b824182fc643c4e295b7178b84e71fdded54.tar.gz |
* ext/json, lib/json, test/json: Update to JSON 1.1.2.
(RubyForge#15447)
* math.c: fix typo.
--
M ChangeLog
M math.c
M ext/json/ext/generator/generator.c
M ext/json/ext/parser/parser.rl
M ext/json/ext/parser/parser.c
M lib/json/version.rb
M lib/json/editor.rb
M lib/json/common.rb
M lib/json/pure/parser.rb
M test/json/test_json_unicode.rb
M test/json/test_json_fixtures.rb
M test/json/test_json_generate.rb
M test/json/test_json_addition.rb
M test/json/test_json.rb
M test/json/runner.rb
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/json/pure')
-rw-r--r-- | lib/json/pure/parser.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/json/pure/parser.rb b/lib/json/pure/parser.rb index 4d63464320..e886ba8d2c 100644 --- a/lib/json/pure/parser.rb +++ b/lib/json/pure/parser.rb @@ -58,6 +58,9 @@ module JSON # * *allow_nan*: If set to true, allow NaN, Infinity and -Infinity in # defiance of RFC 4627 to be parsed by the Parser. This option defaults # to false. + # * *create_additions*: If set to false, the Parser doesn't create + # additions even if a matchin class and create_id was found. This option + # defaults to true. def initialize(source, opts = {}) super if !opts.key?(:max_nesting) # defaults to 19 @@ -68,7 +71,9 @@ module JSON @max_nesting = 0 end @allow_nan = !!opts[:allow_nan] - @create_id = JSON.create_id + ca = true + ca = opts[:create_additions] if opts.key?(:create_additions) + @create_id = ca ? JSON.create_id : nil end alias source string @@ -235,11 +240,10 @@ module JSON if delim raise ParserError, "expected next name, value pair in object at '#{peek(20)}'!" end - if klassname = result[@create_id] + if @create_id and klassname = result[@create_id] klass = JSON.deep_const_get klassname break unless klass and klass.json_creatable? result = klass.json_create(result) - result end break when skip(IGNORE) |