Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
class method
JSON.on_mixed_keys_hash
on_mixed_keys_hash(hash)
ext/json/lib/json/common.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/ext/json/lib/json/common.rb, line 112
def on_mixed_keys_hash(hash)
set = {}
hash.each_key do |key|
key_str = key.to_s
if set[key_str]
raise GeneratorError, "detected duplicate key #{key_str.inspect} in #{hash.inspect}"
else
set[key_str] = true
end
end
end
Called from the extension when a hash has both string and symbol keys