dtas-all
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/3] dtas-console: pass kwargs as-is to String#encode


From: Eric Wong
Subject: [PATCH 2/3] dtas-console: pass kwargs as-is to String#encode
Date: Thu, 31 Oct 2019 10:00:53 +0000

Ruby 2.7.0dev will warn when hashes are passed and intended
for use as kwargs unless we expand the hash via "**enc_opts",
but "**" is Ruby 2.0+ syntax and I guess we still support
1.9.3 for the time being.
---
 bin/dtas-console | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/dtas-console b/bin/dtas-console
index 877c9c4..2143e65 100755
--- a/bin/dtas-console
+++ b/bin/dtas-console
@@ -119,7 +119,6 @@ def may_fail(res, events)
 pre_mute_vol = 1.0
 enc_locale = Encoding.find("locale")
 $stdout.set_encoding(enc_locale)
-enc_opts = { undef: :replace, invalid: :replace, replace: '?' }
 begin
   Curses.init_screen
   Curses.nonl
@@ -165,7 +164,8 @@ def may_fail(res, events)
       # FS encoding != locale encoding, but we need to display an FS path
       # name to whatever locale the terminal is encoded to, so force it
       # and risk mojibake...
-      infile.encode(enc_locale, enc_opts)
+      infile.encode(enc_locale,
+                    undef: :replace, invalid: :replace, replace: '?')
       Curses.setpos(lineno += 1, 0)
       Curses.clrtoeol
       Curses.addstr(infile)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]