Skip to content

Commit

Permalink
[DOC] Fix typo in example code for String#encode method
Browse files Browse the repository at this point in the history
The example code in the documentation for the `String#encode` method has
a typo in the `fallback` option. The example code uses `h` as the
fallback option, but it should use `hash` instead to match the variable
name in the example code.
  • Loading branch information
alex-ross committed May 14, 2024
1 parent 44f50f4 commit 41e6fd0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion doc/encodings.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ These keyword-value pairs specify encoding options:

hash = {"\u3042" => 'xyzzy'}
hash.default = 'XYZZY'
s.encode('ASCII', fallback: h) # => "xyzzyfooXYZZY"
s.encode('ASCII', fallback: hash) # => "xyzzyfooXYZZY"

def (fallback = "U+%.4X").escape(x)
self % x.unpack("U")
Expand Down

0 comments on commit 41e6fd0

Please sign in to comment.