RubyでSSG実装するためにいろいろググってて発見したコード、

AClass.new.tap { |an_instance|
# ...なんかいろいろ
}

ってのがあってちょっと混乱した。なんでtapつかったよ。

どうみてもつかう必要無くて、

an_instance = AClass.new
# ...なんかいろいろ

で十分なかんじだった

まあなんかの名残かもねえ

どっちにしろObject#tapってつかった事ないなあ。Ruby 1.8.7からあるのか。

0

If you have a fediverse account, you can quote this note from your own instance. Search https://sandbox.skoji.jp/users/skoji/statuses/116247731639948473 on your instance and quote it. (Note that quoting is not supported in Mastodon.)