Tbpgr Blog

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

2014-05-09から1日間の記事一覧

Ruby | Collecting Inputs | Reject unworkable values with preconditions

概要 Reject unworkable values with preconditions 前提 Confident Rubyではメソッド内の処理を次のように分類しています。 ・Collecting Inputs(引数チェック、変換など) ・Performing Work(主処理) ・Delivering Output(戻り値に関わる処理) ・Handling…

Ruby | Collecting Inputs | Use transparent adapters to gradually introduce abstraction

概要 Use transparent adapters to gradually introduce abstraction 前提 Confident Rubyではメソッド内の処理を次のように分類しています。 ・Collecting Inputs(引数チェック、変換など) ・Performing Work(主処理) ・Delivering Output(戻り値に関わる…

Ruby | Collecting Inputs | Wrap collaborators in Adapter

概要 Wrap collaborators in Adapter 前提 Confident Rubyではメソッド内の処理を次のように分類しています。 ・Collecting Inputs(引数チェック、変換など) ・Performing Work(主処理) ・Delivering Output(戻り値に関わる処理) ・Handling Failure(例外…

Ruby | Kernel | catch

概要 Kernel#catch(tag) {|tag| .... } -> object 詳細 Kernel.#throwとの組み合わせて大域脱出を行います。要はgoto文的な使い方になります。 主にネストしたループから一気に脱出するのに使用。 サンプルコード # encoding: utf-8 require 'pp' ret = catc…

TbpgrUtils | 追加要件 String#justify_char 追加

概要 追加要件 String#justify_char 追加 詳細 追加要件 String#justify_char 仕様 ・複数行の各行を指定したseparatorで2分割し、各列の幅を揃えます。 ※より詳細についてはGitHubのREADMEおよびテストケース参照 GitHub https://github.com/tbpgr/tbpgr_ut…