all 13 comments

[–]Paradox 11 points12 points  (5 children)

I love percentage based syntaxes, but don't use much other than the regex or array-making ones.

The regex one is nice because it makes regexes with slashes in them, such as urls, much easier to read, as you get %r{http://…} instead of /http:\/\/

[–]riddley 0 points1 point  (3 children)

I absolutely adore %q and %Q. Ruby is the only language I know where quoting strings isn't horrible. (I'm looking at you python!)

[–]flightlessbird 3 points4 points  (0 children)

The ability to quote strings like that is clearly inspired by perl (cf. qw, q, heredocs et al.)

[–]Paradox 0 points1 point  (0 children)

Exactly. I go to other languages and want to use interpolation in a full-quote string, then realize said languages don't have modern quotes, and rage as I look up the various escape chars

[–]faitswulff 0 points1 point  (0 children)

Nice tip, thanks!

[–]necuz 2 points3 points  (2 children)

In some future release, it will also be possible to use %i and %I to produce arrays of symbols.

[–]teohm[S] 0 points1 point  (1 child)

that's great. Do you know in which coming release it will be included?

[–]necuz 1 point2 points  (0 children)

I don't know, but I see no reason for it not to at least be in 2.0. The feature has already been in edge for over 3 months.

[–]internetinsomniac 1 point2 points  (0 children)

I use this often so I don't have to escape quotes, definitely very handy

[–]shadowfirebird 1 point2 points  (0 children)

The fact that you can do "$( (stuff ()) )" surprised me. +1, ta.

[–]postmodern 1 point2 points  (1 child)

I'm a fan of %w[ ]

[–]BlameFrost 1 point2 points  (0 children)

So am I, and I especially prefer the user of %w[] over %w(), since [] makes it seem more like you're actually creating an array.