From: Junkone Date: 2008-07-01T19:07:17+09:00 Subject: Re: meaning of %w On Jul 1, 5:36 am, Peņa, Botp wrote: > From: Junkone [mailto:junko...@gmail.com] > # in rails, this is how it create the options for select box. > # <%= select(:rawdata, :symbol, %w{ AUD.USD-IDEALPRO-CASH EUR.GBP- > # IDEALPRO-CASH EUR.JPY-IDEALPRO-CASH EUR.USD-IDEALPRO-CASH GBP.USD- > # IDEALPRO-CASH USD.CAD-IDEALPRO-CASH USD.CHF-IDEALPRO-CASH }) %> > # what does the %w signify. > > in ruby, i learn by reading ruby-doc, and do-ing it using irb ;) > > a = %w{ AUD.USD-IDEALPRO-CASH EUR.GBP-IDEALPRO-CASH EUR.JPY-IDEALPRO-CASH EUR.USD-IDEALPRO-CASH GBP.USD-IDEALPRO-CASH USD.CAD-IDEALPRO-CASH USD.CHF-IDEALPRO-CASH } > > a.class > #=> Array > > p a > ["AUD.USD-IDEALPRO-CASH", "EUR.GBP-IDEALPRO-CASH", "EUR.JPY-IDEALPRO-CASH", "EUR.USD-IDEALPRO-CASH", "GBP.USD-IDEALPRO-CASH", "USD.CAD-IDEALPRO-CASH", "USD.CHF-IDEALPRO-CASH"] > > some more examples (note, i can change the delimiters) > > a=%w[this is a test] > #=> ["this", "is", "a", "test"] > > a=%w(1 2 3 4) > #=> ["1", "2", "3", "4"] > > a=%w > #=> ["my", "name", "is", "bot pena"] > > kind regards -botp aah. thanks a lot for showing a new way.