irb(main):002:0> s = ‘[“a string”, “another string”]’
=> "[“a string”, “another string”]"
irb(main):003:0> array = eval s
=> [“a string”, “another string”]
This is great! Thanks Martin. Thanks for all the fast responses as well
I just wanted to follow up on some of the responses here:
- Suggestion to use gsub over sub. I assume that gsub is global?
You assume correctly. Either will work in your particular case.
- what is the “!” responsible for doing? (Remember me = n00b )
Its a hint for a “dangerous” method - generally, one that changes the
receiver. It signals to the reader its intent, but syntactically, its just
part of the identifier. Its like ? methods should return a bool (eg,