2014-05-14から1日間の記事一覧
概要 追加要件 String#uniq_size 追加 詳細 追加要件 String#uniq_size 仕様 ・String#uniq.sizeと同等の処理です。 ※より詳細についてはGitHubのREADMEおよびテストケース参照 GitHub https://github.com/tbpgr/tbpgr_utils Rubygems http://rubygems.org/g…
概要 Use checked methods for risky operations 前提 Confident Rubyではメソッド内の処理を次のように分類しています。 ・Collecting Inputs(引数チェック、変換など) ・Performing Work(主処理) ・Delivering Output(戻り値に関わる処理) ・Handling Fa…
概要 Prefer top-level rescue clause 前提 Confident Rubyではメソッド内の処理を次のように分類しています。 ・Collecting Inputs(引数チェック、変換など) ・Performing Work(主処理) ・Delivering Output(戻り値に関わる処理) ・Handling Failure(例外…
概要 Yield Status Object 前提 Confident Rubyではメソッド内の処理を次のように分類しています。 ・Collecting Inputs(引数チェック、変換など) ・Performing Work(主処理) ・Delivering Outpu(戻り値に関わる処理) ・Handling Failure(例外処理)当記事…
概要 Return Status Object 前提 Confident Rubyではメソッド内の処理を次のように分類しています。 ・Collecting Inputs(引数チェック、変換など) ・Performing Work(主処理) ・Delivering Output(戻り値に関わる処理) ・Handling Failure(例外処理)当記…
概要 Represent failure with a special case object 前提 Confident Rubyではメソッド内の処理を次のように分類しています。 ・Collecting Inputs(引数チェック、変換など) ・Performing Work(主処理) ・Delivering Output(戻り値に関わる処理) ・Handlin…
概要 Represent failure with a benign vlaue 前提 Confident Rubyではメソッド内の処理を次のように分類しています。 ・Collecting Inputs(引数チェック、変換など) ・Performing Work(主処理) ・Delivering Output(戻り値に関わる処理) ・Handling Failu…
概要 Call back instead of returning 前提 Confident Rubyではメソッド内の処理を次のように分類しています。 ・Collecting Inputs(引数チェック、変換など) ・Performing Work(主処理) ・Delivering Output(戻り値に関わる処理) ・Handling Failure(例外…
概要 Write total functions 前提 Confident Rubyではメソッド内の処理を次のように分類しています。 ・Collecting Inputs(引数チェック、変換など) ・Performing Work(主処理) ・Delivering Output(戻り値に関わる処理) ・Handling Failure(例外処理)当記…
概要 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についてはBertrand Meyer氏が書籍「Object Oriented Software Construction」で触れたのが始まり。基本的な考え方は、オブジェクトのメソッドは以下の二つのカテ…
概要 Kernel#gets(rs = $/) -> String | nil 詳細 ARGFから一行読み込んで、それを返します。 rsは区切り文字。省略すると行区切りになる。 getsした内容は$_にも設定されている。ファイルの終わりに到達するとnilを返却する サンプルコード 検証用テキスト(…