Nuby: %w to understand quotes

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

Peña wrote:

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

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

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

···

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

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

     ---
     - 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
--
be kind whenever possible... it is always possible.
- h.h. the 14th dali lama