yet another with()
Mastering Cocoa with Ruby | RubyCocoa Resourcesをみてたらこんなのを発見。
def with(x) yield x if block_given?; x end if not defined? with
ブロックを評価した後にxを返すところがポイント。@y = with(ClassWithLongName.new(args)) do |o| 〜 end てな感じで使えるのでオブジェクトを生成したあとあれこれ設定をした結果をインスタンス変数に覚えさせておくといういかにも「あるある」な使い方ができる。素敵。