Skip to content

Commit a888d6d

Browse files
etiennebarriebyroot
authored andcommitted
Use single quotes for allow_invalid_escape doc
Instead of using %{} which works like double-quoted string and allows escape sequences and in which "other escaped characters (a backslash followed by a character) are interpreted as the character", change the examples for `allow_invalid_escape` to use single-quotes strings, in which "any other character following a backslash [except ' and \] is interpreted as is: a backslash and the character itself." This makes it clearer the JSON document only includes a single backslash.
1 parent 05cec0c commit a888d6d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/json.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,10 @@
201201
# defaults to +false+.
202202
#
203203
# With the default, +false+:
204-
# JSON.parse(%{"Hell\\o"}) # invalid escape character in string (JSON::ParserError)
204+
# JSON.parse('"Hell\o"') # invalid escape character in string (JSON::ParserError)
205205
#
206206
# When enabled:
207-
# JSON.parse(%{"Hell\\o"}, allow_invalid_escape: true) # => "Hello"
207+
# JSON.parse('"Hell\o"', allow_invalid_escape: true) # => "Hello"
208208
#
209209
# ====== Output Options
210210
#

0 commit comments

Comments
 (0)