# Re: nuby: %w to understand quotes

**URL:** <https://www.ruby-forum.com/t/re-nuby-w-to-understand-quotes/94134>\
**Category:** Ruby\
**Created:** [April 22, 2006, 8:19am UTC](https://www.ruby-forum.com/t/re-nuby-w-to-understand-quotes/94134 "2006-04-22T08:19:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PeSSSSaS\_Botp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ecd19e/32.png) [@PeSSSSaS\_Botp](https://www.ruby-forum.com/u/PeSSSSaS_Botp)\
**Post date:** [April 22, 2006, 8:19am UTC](https://www.ruby-forum.com/t/re-nuby-w-to-understand-quotes/94134/1 "2006-04-22T08:19:15Z")

</div>

Jake and Matz wrote:

# %w{this\ is a\ test}

cool. escaping the space.

many thanks, jake/matz.

otoh, i am also ending up w lots of escapes like for longer strings

%w{ sample  
short\ sample  
there\ is\ quite\ a\ number\ of\ strings\ longer\ than\ this  
}

if %w will optionally respect quotes, then it may simplify

kind regards -botp

---

<div class="post-metadata">

**Author:** ![PeSSSSaS\_Botp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ecd19e/32.png) [@PeSSSSaS\_Botp](https://www.ruby-forum.com/u/PeSSSSaS_Botp)\
**Post date:** [April 22, 2006, 11:08am UTC](https://www.ruby-forum.com/t/re-nuby-w-to-understand-quotes/94134/2 "2006-04-22T11:08:30Z")

</div>

Peña wrote:

> %w{ sample  
> short\ sample  
> there\ is\ quite\ a\ number\ of\ strings\ longer\ than\ this  
> }
> 
> if %w will optionally respect quotes, then it may simplify
> 
> kind regards -botp

In that case, wouldn’t it be easier to just do

[“sample”, “short sample”, “there is quite a number of strings longer  
than this”]

etc?

-Justin

---

<div class="post-metadata">

**Author:** ![PeSSSSaS\_Botp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ecd19e/32.png) [@PeSSSSaS\_Botp](https://www.ruby-forum.com/u/PeSSSSaS_Botp)\
**Post date:** [April 22, 2006, 4:14pm UTC](https://www.ruby-forum.com/t/re-nuby-w-to-understand-quotes/94134/3 "2006-04-22T16:14:39Z")

</div>

On Sat, 22 Apr 2006, [iso-8859-1] Peña, Botp wrote:

> %w{ sample  
> short\ sample  
> there\ is\ quite\ a\ number\ of\ strings\ longer\ than\ this  
> }
> 
> if %w will optionally respect quotes, then it may simplify

i use this idiom:

```
 harp:~ > cat a.rb
 list = %Q[

    sample

    short sample

    there is quite a number of strings longer than this

    it's '#{ Time.now }' now

 ].scan %r/[^\s].*[^\s]/

 require 'yaml'
 y list

 harp:~ > ruby a.rb
 ---
 - sample
 - short sample
 - there is quite a number of strings longer than this
 - it's 'Sat Apr 22 08:11:37 MDT 2006' now

```

cheers.

-a
