method_missing magic

method_missing magic - emulating Groovy's "it" in Ruby

people.select { |x| x.name.length > 10 }

people.select(&its.name.length > 10)

と書けるよ、という話。すごい。
ブロックパラメータが冗長だなと感じることはたまにあるので、いいなと。

a = (0...100).map(&its ** 3) # 100個の立方数
a.select(&its >= 1000 && &its <= 9999) # 4桁のを選ぶ

は、1行目は大丈夫だけど、2行目はエラー。うーん、ソースをちゃんと読まないと。
まあ、

a.select(&its.to_s.length == 4)

でいいんだけど。