Junkone
7/1/2008 10:06:00 AM
On Jul 1, 5:36 am, Peña, Botp <b...@delmonte-phil.com> 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>
> #=> ["my", "name", "is", "bot pena"]
>
> kind regards -botp
aah. thanks a lot for showing a new way.