I was researching something else and thought this was a cool way to execute a command through the open method in ruby:

1
open("|[CMD]")

The key is starting the open with pipe. For example,

1
open("|ls")

Or to exec and print the result in one line:

1
open("|ls").each {|out| puts out }

Not sure where I saw it originally, but this is an interesting older read: https://devver.wordpress.com/2009/06/30/a-dozen-or-so-ways-to-start-sub-processes-in-ruby-part-1/