Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
JSON::Ext::Generator::State#to_h
to_h
ext/json/lib/json/ext/generator/state.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/ext/json/lib/json/ext/generator/state.rb, line 65
def to_h
result = {
indent: indent,
space: space,
space_before: space_before,
object_nl: object_nl,
array_nl: array_nl,
allow_nan: allow_nan?,
ascii_only: ascii_only?,
max_nesting: max_nesting,
script_safe: script_safe?,
strict: strict?,
depth: depth,
buffer_initial_length: buffer_initial_length,
}
instance_variables.each do |iv|
iv = iv.to_s[1..-1]
result[iv.to_sym] = self[iv]
end
result
end
Returns the configuration instance variables as a hash, that can be passed to the configure method.