diff options
author | Jean Boussier <[email protected]> | 2024-10-29 17:36:04 +0100 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2024-11-01 13:04:24 +0900 |
commit | 7daa1083c93d237b4e03d4b07d3f0c124486bec0 (patch) | |
tree | a107747ef3734e6e084b568302a6db2ffaba09d0 /lib/json | |
parent | 5dc3b15b3c2c2f2c2cc5f1522f865b56574ae63f (diff) |
[ruby/json] Move State#configure back into C
While less nice, this open the door to eluding the State object
allocation when possible.
https://github.com/ruby/json/commit/5c0d428d4c
Diffstat (limited to 'lib/json')
-rw-r--r-- | lib/json/ext/generator/state.rb | 32 |
1 files changed, 1 insertions, 31 deletions
diff --git a/lib/json/ext/generator/state.rb b/lib/json/ext/generator/state.rb index 29688142f0..6cd9496e67 100644 --- a/lib/json/ext/generator/state.rb +++ b/lib/json/ext/generator/state.rb @@ -42,37 +42,7 @@ module JSON raise TypeError, "can't convert #{opts.class} into Hash" end end - - opts.each do |key, value| - case key - when :indent - self.indent = value || '' - when :space - self.space = value || '' - when :space_before - self.space_before = value || '' - when :array_nl - self.array_nl = value || '' - when :object_nl - self.object_nl = value || '' - when :max_nesting - self.max_nesting = value || 0 - when :depth - self.depth = value - when :buffer_initial_length - self.buffer_initial_length = value - when :allow_nan - self.allow_nan = value - when :ascii_only - self.ascii_only = value - when :script_safe, :escape_slash - self.script_safe = value - when :strict - self.strict = value - end - end - - self + _configure(opts) end alias_method :merge, :configure |