3 ms·
%q allows different delimiters to represent single quoted strings, which doesn't have string interpolation. For ex: $ ruby -e 'a=5; puts "[#{a}]"' [5]
by asicsp 6y ago
%q allows different delimiters to represent single quoted strings, which doesn't have string interpolation. For ex:
$ ruby -e 'a=5; puts "[#{a}]"'
[5]
$ ruby -e 'a=5; puts %q/[#{a}]/'
[#{a}]
- byroot 6y ago%Q or just % does interpolation: $ ruby -e 'a=5; puts %Q/[#{a}]/' [5] $ ruby -e 'a=5; puts %/[#{a}]/' [5]