From 41e6fd066e8ea82c460ba392a1dd55d624a19763 Mon Sep 17 00:00:00 2001 From: Alexander Ross Date: Tue, 14 May 2024 10:22:36 +0200 Subject: [PATCH] [DOC] Fix typo in example code for `String#encode` method 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. --- doc/encodings.rdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/encodings.rdoc b/doc/encodings.rdoc index 97c0d22616..d85099cdbc 100644 --- a/doc/encodings.rdoc +++ b/doc/encodings.rdoc @@ -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")