[Groonga-commit] droonga/drnbench at bbb3173 [master] Separate definition of client and result classes from runner.rb

アーカイブの一覧に戻る

YUKI Hiroshi yuki****@clear*****
Fri Oct 11 11:13:38 JST 2013


すみません、Ruby力が低下していてヒアドキュメントの事を忘れていただけです……
あと、元のコードが puts で1行ずつ標準出力に出すコードだったからというの 
もあります。

Kenji Okimoto wrote:
>> +        def to_s
>> +          "Total requests: #{total_n_requests} " +
>> +            "(#{queries_per_second} queries per second)\n" +
>> +          "Status:\n" +
>> +          status_percentages.collect do |status, percentage|
>> +            "  #{status}: #{percentage} %"
>> +          end.join("\n") + "\n" +
>> +          "Elapsed time:\n" +
>> +          "  min:     #{min_elapsed_time} sec\n" +
>> +          "  max:     #{max_elapsed_time} sec\n" +
>> +          "  average: #{average_elapsed_time} sec"
>> +        end
>
> ヒアドキュメント使わないのは何か理由がありますか?
> ここまで複雑ならヒアドキュメントを使った方がすっきりするように思いました。
>
> 例えば、動かしてませんが、以下のような感じでしょうか。 "\n" とか + とか
> が減ってすっきりしていると思います。
>
> def to_s
>     _status = status_percentages.collect do |status, percentage|
>       "  #{status}: #{percentage} %"
>     end.join("\n")
> <<-EOS.chomp
> Total requests: #{total_n_requests}
>     (#{queries_per_second} queries per second)
> Status:
> #{_status}
> Elapsed time:
>     min:     #{min_elapsed_time} sec
>     max:     #{max_elapsed_time} sec
>     average: #{average_elapsed_time} sec
> EOS
> end
>
>
>
> On 2013年10月11日 10:23, YUKI Hiroshi wrote:
>> Author
>>      YUKI Hiroshi <shimoda �� clear-code.com>
>> Date
>>      2013-10-11 10:23:44 +0900 (Fri, 11 Oct 2013)
>> New Revision
>>      bbb317346cf5d393afb3cf952c3daae62084a43d <https://github.com/droonga/drnbench/commit/bbb317346cf5d393afb3cf952c3daae62084a43d>
>> Message
>>
>>      Separate definition of client and result classes from runner.rb
>>
>> Added files
>>
>>        * lib/droonga/benchmark/client/http.rb <https://github.com/droonga/drnbench/commit/bbb317346cf5d393afb3cf952c3daae62084a43d#diff-0>
>>        * lib/droonga/benchmark/result.rb <https://github.com/droonga/drnbench/commit/bbb317346cf5d393afb3cf952c3daae62084a43d#diff-1>
>>
>> Modified files
>>
>>        * lib/droonga/benchmark/runner.rb <https://github.com/droonga/drnbench/commit/bbb317346cf5d393afb3cf952c3daae62084a43d#diff-2>
>>
>>     Added: lib/droonga/benchmark/client/http.rb (+69 -0) 100644
>> ===================================================================
>>
>

-- 
結城 洋志 <YUKI Hiroshi>
E-mail: yuki �� clear-code.com

株式会社クリアコード
〒113-0033 東京都文京区本郷3-27-12
            本郷デントビル2階
TEL : 03-6231-7270
FAX : 03-6231-7271
WWW : http://www.clear-code.com/




More information about the Groonga-commit mailing list
アーカイブの一覧に戻る