K
Koncept
Hi. What a fantastic language. This is my first day learning using it
and I *love* it so far.
I am not very comfortable with Ruby speak yet, so I hope the
explaination of my problem makes some kind of sense.
I have a program that fetches some results from a shell script. The
result is a string, not a block as it may look like below.
result = { "foobar", "foobar", "foobar" }
I want to basically remove the {}'s and replace them with [] and cast
result as an array so that I can have some fun within Ruby.
I figured something like this:
result = result.sub(/\{/,'[')
result = result.sub(/\}/,']')
Now I have a string that *LOOKS* like and Array but isn't....
Any suggestions are more than welcome.
and I *love* it so far.
I am not very comfortable with Ruby speak yet, so I hope the
explaination of my problem makes some kind of sense.
I have a program that fetches some results from a shell script. The
result is a string, not a block as it may look like below.
result = { "foobar", "foobar", "foobar" }
I want to basically remove the {}'s and replace them with [] and cast
result as an array so that I can have some fun within Ruby.
I figured something like this:
result = result.sub(/\{/,'[')
result = result.sub(/\}/,']')
Now I have a string that *LOOKS* like and Array but isn't....
Any suggestions are more than welcome.