summaryrefslogtreecommitdiff
path: root/ext/json/lib
diff options
context:
space:
mode:
-rw-r--r--ext/json/lib/json/common.rb127
1 files changed, 119 insertions, 8 deletions
@@ -5,6 +5,112 @@ require 'json/version'
module JSON
autoload :GenericObject, 'json/generic_object'
class << self
# :call-seq:
# JSON[object] -> new_array or new_string
@@ -236,9 +342,16 @@ module JSON
# JSON.parse('')
#
def parse(source, opts = nil)
Parser.parse(source, opts)
end
# :call-seq:
# JSON.parse!(source, opts) -> object
#
@@ -251,12 +364,11 @@ module JSON
# which disables checking for nesting depth.
# - Option +allow_nan+, if not provided, defaults to +true+.
def parse!(source, opts = nil)
- options = {
- :max_nesting => false,
- :allow_nan => true
- }
- options.merge!(opts) if opts
- Parser.new(source, options).parse
end
# :call-seq:
@@ -859,10 +971,9 @@ module JSON
options[:strict] = true
end
options[:as_json] = as_json if as_json
- options[:create_additions] = false unless options.key?(:create_additions)
@state = State.new(options).freeze
- @parser_config = Ext::Parser::Config.new(options)
end
# call-seq: