Nuby: %w to understand quotes

Hi All,

irb(main):007:0> %w{this is a test}
=> ["this", "is", "a", "test"]

fine.

irb(main):008:0> %w{"this is" "a test"}
=> ["\"this", "is\"", "\"a", "test\""]

i want

["this is","a test"]

Is there a ruby notation like %w that understand quotes?

thank you and kind regards -botp

Try this:

%w{this\ is a\ test}

- Jake McArthur

···

On Apr 22, 2006, at 12:48 AM, Peña, Botp wrote:

Hi All,

irb(main):007:0> %w{this is a test}
=> ["this", "is", "a", "test"]

fine.

irb(main):008:0> %w{"this is" "a test"}
=> ["\"this", "is\"", "\"a", "test\""]

i want

["this is","a test"]

Is there a ruby notation like %w that understand quotes?

thank you and kind regards -botp

Hi,

irb(main):008:0> %w{"this is" "a test"}
=> ["\"this", "is\"", "\"a", "test\""]

i want

["this is","a test"]

Is there a ruby notation like %w that understand quotes?

%w understands backslash escape

irb(main):001:0> %w{this\ is a\ test}
=> ["this is","a test"]

              matz.

···

In message "Re: nuby: %w to understand quotes" on Sat, 22 Apr 2006 14:48:46 +0900, Peña, Botp <botp@delmonte-phil.com> writes: