Skip to content

Commit faa5572

Browse files
duffuniversebyroot
authored andcommitted
Fix a few inconsistencies in readme
1 parent 724edda commit faa5572

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Both of these behavior can be disabled using the `strict: true` option:
8585

8686
```ruby
8787
JSON.generate(Object.new, strict: true) # => Object not allowed in JSON (JSON::GeneratorError)
88-
JSON.generate(Position.new(1, 2)) # => Position not allowed in JSON (JSON::GeneratorError)
88+
JSON.generate(Position.new(1, 2), strict: true) # => Position not allowed in JSON (JSON::GeneratorError)
8989
```
9090

9191
## JSON::Coder
@@ -117,13 +117,13 @@ It is also called for objects that do have a JSON equivalent, but are used as Ha
117117
as well as for strings that aren't valid UTF-8:
118118

119119
```ruby
120-
coder = JSON::Combining.new do |object, is_object_key|
120+
coder = JSON::Coder.new do |object, is_object_key|
121121
case object
122122
when String
123-
if !string.valid_encoding? || string.encoding != Encoding::UTF_8
124-
Base64.encode64(string)
123+
if !object.valid_encoding? || object.encoding != Encoding::UTF_8
124+
Base64.encode64(object)
125125
else
126-
string
126+
object
127127
end
128128
else
129129
object

0 commit comments

Comments
 (0)