Is this escaping just to make it work on the commandline via system() ? If so, there is 'shellwords' in ruby:

```
>> require "shellwords"
>> puts Shellwords.shellescape('hello world "foo bar!" baz!')
hello\ world\ \"foo\ bar\!\"\ baz\!
```

Thoughts? :)