This could be simplified to:

```ruby
@get_result ||= shell_out('cat', Array(query).join("\n")).stdout
```