One thing I love about ruby is that mostly it is a very readable language (which is great for self-documenting code)
However, inspired by this question: Ruby Code ex
I like this:
str = "Something evil this way comes!" regexp = /(\w[aeiou])/ str[regexp, 1] # <- This
Which is (roughly) equivalent to:
str_match = str.match(regexp) str_match[1] unless str_match.nil?
Or at least that's what I've used to replace such blocks.