Tbpgr Blog

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

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

TbpgrUtils | 追加要件 String#uniq_size 追加

概要 追加要件 String#uniq_size 追加 詳細 追加要件 String#uniq_size 仕様 ・String#uniq.sizeと同等の処理です。 ※より詳細についてはGitHubのREADMEおよびテストケース参照 GitHub https://github.com/tbpgr/tbpgr_utils Rubygems http://rubygems.org/g…

Ruby | Handling Failure | Use checked methods for risky operations

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

Ruby | Handling Failure | Prefer top-level rescue clause

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

Ruby | Delivering Output | Yield Status Object

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

Ruby | Delivering Output | Return Status Object

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

Ruby | Delivering Output | Represent failure with a special case object

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

Ruby | Delivering Output | Represent failure with a benign vlaue

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

Ruby | Delivering Result | Call back instead of returning

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

Ruby | Delivering Result | Write total functions

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

Ruby | dRubyを試してみる

概要 dRubyを試してみる サンプルコード(Server) require 'drb/drb' class Server def initialize(stream=$stdout) @stream = stream end def puts(str) @stream.puts("Hello dRuby '#{str}'") end end uri = ARGV.shift DRb.start_service(uri, Server.ne…

原則 | Command/Query Separation(コマンド・クエリ分離の原則)

概要 Command/Query Separation(コマンド・クエリ分離の原則) 詳細 Command/Query SeparationについてはBertrand Meyer氏が書籍「Object Oriented Software Construction」で触れたのが始まり。基本的な考え方は、オブジェクトのメソッドは以下の二つのカテ…

Ruby | Kernel | gets

概要 Kernel#gets(rs = $/) -> String | nil 詳細 ARGFから一行読み込んで、それを返します。 rsは区切り文字。省略すると行区切りになる。 getsした内容は$_にも設定されている。ファイルの終わりに到達するとnilを返却する サンプルコード 検証用テキスト(…