I\'m referring to the %w operator/constructor/whatever you may call it, used like this:
%w{ foo bar baz }
=> [\"foo\", \"bar\", \"baz\"]
Not actually sure, string encoded literals I guess.
Nope. You can use almost any character actually. If you start with a {
, [
or (
you need to close with the closing counterpart of that character, but other characters are closed with the same character. You probably want to use a character that is not going to appear inside your literal.
%w_ foo bar _
Not one for an array of symbols, but there is a %q
for a single quoted string, %Q
for a double quoted string, %r
for a regex, and probably a few other as well I am forgetting.
Nope. They are for quick and easy ways to create simple objects. If you need nesting, you need to use the more verbose syntax.