3 ms·
I'm not sure if Ruby borrowed the full range of q and qq operators, but it offers Percent strings: https://ruby-doc.org/core-2.7.1/doc/syntax/literals_rdoc.html
by asicsp 6y ago
I'm not sure if Ruby borrowed the full range of q and qq operators, but it offers Percent strings: https://ruby-doc.org/core-2.7.1/doc/syntax/literals_rdoc.html#label-Percent+Strings https://ruby-doc.org/core-2.7.1/doc/syntax/literals_rdoc.htm...
- tasogare 6y agoThis is just string interpolation.
- 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]