From: eregontp@... Date: 2020-04-12T13:11:53+00:00 Subject: [ruby-core:97857] [Ruby master Feature#16779] Add sprintf %q format option Issue #16779 has been updated by Eregon (Benoit Daloze). `%p` is part of the documentation of `sprintf` but maybe it's not so clear. PR welcome to improve that documentation. ---------------------------------------- Feature #16779: Add sprintf %q format option https://bugs.ruby-lang.org/issues/16779#change-85082 * Author: gearnode (Bryan Frimin) * Status: Rejected * Priority: Normal ---------------------------------------- It would be great to have format option for quoted string for sprintf (like golang sprintf), it's particularly useful to format log message for example. Currently we have to do this: ``` ruby sprintf("%s", some_value.inspect.dump) ``` I propose to introduce the `%q` format option which allow to do this: ```ruby sprintf("%q", some_value) ``` ---Files-------------------------------- add-quoted-string-sprintf-format.patch (1.52 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: