Tbpgr Blog

Employee Experience Engineer tbpgr(てぃーびー) のブログ

2014-10-31から1日間の記事一覧

Ruby | Proc | to_proc

概要 Proc#to_proc -> self 詳細 自身を返却。 Duck Typing 用か? サンプルコード require 'tbpgr_utils' p1 = Proc.new {} p2 = proc {} p3 = lambda {} class Sum def sum(a, b) a + b end def to_proc -> (a, b) {a + b} end end def use_proc(a, b, pr)…