2012-02-23から1日間の記事一覧

Rubyの四則演算をもっと便利にしたいよ!

この間RubyのEnumerable#mapを便利にした Enumerable#mappを紹介したよ RubyのEnumerable#mapをもっと便利にしたいよ - hp12c module Enumerable def mapp(op=nil, *args, &blk) op ? map { |e| op.intern.to_proc[e, *args]} : map(&blk) end end langs = […