summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFlorian Frank <flori@ping.de>2015-06-15 22:39:32 +0200
committerFlorian Frank <flori@ping.de>2015-06-15 22:47:04 +0200
commit500738e0052eebb306b9e972e2b70065972e45be (patch)
tree874076eda0e85250080c93d101673009c3a390b3 /lib
parent68ce5b6b564f87edd1d4f005a39a230e544d15e8 (diff)
downloadjson-500738e0052eebb306b9e972e2b70065972e45be.tar.gz
Disallow usage of symbolize_names and create_additions
Diffstat (limited to 'lib')
-rw-r--r--lib/json/pure/parser.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/json/pure/parser.rb b/lib/json/pure/parser.rb
index acabe39..c5d1501 100644
--- a/lib/json/pure/parser.rb
+++ b/lib/json/pure/parser.rb
@@ -61,8 +61,9 @@ module JSON
# defiance of RFC 4627 to be parsed by the Parser. This option defaults
# to false.
# * *symbolize_names*: If set to true, returns symbols for the names
- # (keys) in a JSON object. Otherwise strings are returned, which is also
- # the default.
+ # (keys) in a JSON object. Otherwise strings are returned, which is
+ # also the default. It's not possible to use this option in
+ # conjunction with the *create_additions* option.
# * *create_additions*: If set to true, the Parser creates
# additions when if a matching class and create_id was found. This
# option defaults to false.
@@ -90,6 +91,9 @@ module JSON
else
@create_additions = false
end
+ @symbolize_names && @create_additions and raise ArgumentError,
+ 'options :symbolize_names and :create_additions cannot be used '\
+ 'in conjunction'
@create_id = @create_additions ? JSON.create_id : nil
@object_class = opts[:object_class] || Hash
@array_class = opts[:array_class] || Array