From 351a550fd0fb7d436624d9d3960e3968da4ec53f Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Fri, 26 Jun 2026 16:33:50 +0300 Subject: [PATCH] Fix a few inconsistencies in readme --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index cb57ab69..5e6ffe48 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ Both of these behavior can be disabled using the `strict: true` option: ```ruby JSON.generate(Object.new, strict: true) # => Object not allowed in JSON (JSON::GeneratorError) -JSON.generate(Position.new(1, 2)) # => Position not allowed in JSON (JSON::GeneratorError) +JSON.generate(Position.new(1, 2), strict: true) # => Position not allowed in JSON (JSON::GeneratorError) ``` ## JSON::Coder @@ -117,13 +117,13 @@ It is also called for objects that do have a JSON equivalent, but are used as Ha as well as for strings that aren't valid UTF-8: ```ruby -coder = JSON::Combining.new do |object, is_object_key| +coder = JSON::Coder.new do |object, is_object_key| case object when String - if !string.valid_encoding? || string.encoding != Encoding::UTF_8 - Base64.encode64(string) + if !object.valid_encoding? || object.encoding != Encoding::UTF_8 + Base64.encode64(object) else - string + object end else object