There's an echo in my head

日々のメモ。

2012-11-14から1日間の記事一覧

Object#instance_execでブロック引数を省略する

def configure(&block) @config ||= Configuration.new block.call(@config) end configure do |config| config.use :yaml end みたいなのが、Object#instance_execを使うとスッキリ書ける。 def configure(&block) @config ||= Configuration.new @config.i…

このブログに出てくるコードスニペッツは、引用あるいは断りがない限りMITライセンスです。