Tbpgr Blog

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

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

Ruby | Object | to_s

概要 Object#to_s -> String 詳細 オブジェクトの文字列表現を返却。 Kernel.#print や 文字列の変数展開などの際に呼び出される。 サンプルコード Person = Struct.new(:name, :age) tanaka = Person.new('tanaka', 34) print tanaka.to_s, "\n" print "#{t…