Method: PSON.parse!
- Defined in:
- lib/puppet/external/pson/common.rb
.parse!(source, opts = {}) ⇒ Object
Parse the PSON string source into a Ruby data structure and return it. The bang version of the parse method, defaults to the more dangerous values for the opts hash, so be sure only to parse trusted source strings.
opts can have the following keys:
-
max_nesting: The maximum depth of nesting allowed in the parsed data structures. Enable depth checking with :max_nesting => anInteger. The parse! methods defaults to not doing max depth checking: This can be dangerous, if someone wants to fill up your stack.
-
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 true.
136 137 138 139 140 141 142 |
# File 'lib/puppet/external/pson/common.rb', line 136 def parse!(source, opts = {}) opts = { :max_nesting => false, :allow_nan => true }.update(opts) PSON.parser.new(source, opts).parse end |