5 ms·
Never knew you can do it in Ruby too, thanks for sharing. I’ve missed that from python a lot.
by ernst_klim 3y ago
Never knew you can do it in Ruby too, thanks for sharing. I’ve missed that from python a lot.
- inferiorhuman 3y agoSo I firmly believe that using shell expansion in your scripts is a horrid idea no matter what the syntax. But while you're thinking about backticks and ruby: Much like a modern POSIX shell you can also use the more ergonomic %x (e.g. %x{echo true} %x(echo false). Backticks will perform string interpolation before execution just like a normal double quoted string. Backticks are simply a method, so you can redefine that on any object.