summaryrefslogtreecommitdiff
path: root/lib/json
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2024-10-28 08:34:43 +0100
committerHiroshi SHIBATA <[email protected]>2024-10-29 13:25:01 +0900
commitb094ee3f23097f3e02c54476a0499e590e1bf5d7 (patch)
tree18a99a4dbce57198f43f839f07a3635180e1c79c /lib/json
parent3c9be02af1e44a79191309cf727ede20cc576cb0 (diff)
Handle all formatting configs potentially being `nil`.
Fix: https://github.com/ruby/json/issues/653 I don't think this was really fully supported in the past, but it kinda worked with some of the implementations.
Diffstat (limited to 'lib/json')
-rw-r--r--lib/json/ext/generator/state.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/json/ext/generator/state.rb b/lib/json/ext/generator/state.rb
index 4f9675d7b5..29688142f0 100644
--- a/lib/json/ext/generator/state.rb
+++ b/lib/json/ext/generator/state.rb
@@ -46,15 +46,15 @@ module JSON
opts.each do |key, value|
case key
when :indent
- self.indent = value
+ self.indent = value || ''
when :space
- self.space = value
+ self.space = value || ''
when :space_before
- self.space_before = value
+ self.space_before = value || ''
when :array_nl
- self.array_nl = value
+ self.array_nl = value || ''
when :object_nl
- self.object_nl = value
+ self.object_nl = value || ''
when :max_nesting
self.max_nesting = value || 0
when :depth