YUKI Hiroshi
yuki****@clear*****
Thu Oct 10 10:22:05 JST 2013
個々のattrのためにattr_readerを書くか、そうでないなら1回だけ書くか、のど ちらかでないと主観的にスッキリしないんですよね…… でもRuby的には(もしくはクリアコードのコーディングルールとして)こういう 場面ではattr_readerを分けて2回書くものだ、ということで今後はそのように気 をつけようと思います。 Kouhei Sutou wrote: >> - attr_reader :start_n_clients, :end_n_clients, :step >> + attr_reader :start_n_clients, :end_n_clients, :step, >> + :report_progressively, :result > > 長いときはattr_readerをもう1個書いていいですよ。 > > attr_reader :start_n_clients, :end_n_clients, :step, > attr_reader :report_progressively, :result > > In <6d600c208540ef62d578b02587581eedd2da8aa1 �� jenkins.clear-code.com> > "[Groonga-commit] droonga/http-benchmark �� 6d600c2 [master] Don't output results to the stdout by default" on Wed, 09 Oct 2013 16:32:43 +0900, > YUKI Hiroshi <null+groonga �� clear-code.com> wrote: > >> YUKI Hiroshi 2013-10-09 16:32:43 +0900 (Wed, 09 Oct 2013) >> >> New Revision: 6d600c208540ef62d578b02587581eedd2da8aa1 >> https://github.com/droonga/http-benchmark/commit/6d600c208540ef62d578b02587581eedd2da8aa1 >> >> Message: >> Don't output results to the stdout by default >> >> Modified files: >> lib/droonga/http-benchmark/gradual-runner.rb >> lib/droonga/http-benchmark/runner.rb >> >> Modified: lib/droonga/http-benchmark/gradual-runner.rb (+12 -4) >> =================================================================== >> --- lib/droonga/http-benchmark/gradual-runner.rb 2013-10-09 16:26:36 +0900 (1a29e3e) >> +++ lib/droonga/http-benchmark/gradual-runner.rb 2013-10-09 16:32:43 +0900 (271cd6a) >> @@ -5,7 +5,8 @@ require "droonga/http-benchmark/runner" >> module Droonga >> module HttpBenchmark >> class GradualRunner >> - attr_reader :start_n_clients, :end_n_clients, :step >> + attr_reader :start_n_clients, :end_n_clients, :step, >> + :report_progressively, :result >> >> DEFAULT_START_N_CLIENTS = 1 >> DEFAULT_END_N_CLIENTS = 1 >> @@ -15,12 +16,13 @@ module Droonga >> @start_n_clients = params[:start_n_clients] || DEFAULT_START_N_CLIENTS >> @end_n_clients = params[:end_n_clients] || DEFAULT_END_N_CLIENTS >> @step = params[:step] || DEFAULT_STEP >> + @report_progressively = params[:report_progressively] || false >> @params = params >> end >> >> def run >> run_benchmarks >> - puts****@resul*****_csv >> + @result >> end >> >> private >> @@ -28,8 +30,14 @@ module Droonga >> @result = Result.new >> @start_n_clients.step(@end_n_clients, @step) do |n_clients| >> benchmark = Runner.new(@params.merge(:n_clients => n_clients)) >> - puts "Running benchmark with #{n_clients} clients..." >> - @result << benchmark.run >> + if @report_progressively >> + puts "Running benchmark with #{n_clients} clients..." >> + end >> + benchmark.run >> + if @report_progressively >> + puts benchmark.result.to_s >> + end >> + @result << benchmark.result >> end >> end >> >> >> Modified: lib/droonga/http-benchmark/runner.rb (+0 -1) >> =================================================================== >> --- lib/droonga/http-benchmark/runner.rb 2013-10-09 16:26:36 +0900 (0dcbe58) >> +++ lib/droonga/http-benchmark/runner.rb 2013-10-09 16:32:43 +0900 (585429c) >> @@ -44,7 +44,6 @@ module Droonga >> >> def run >> process_requests >> - puts****@resul*****_s >> @result >> end >> > > _______________________________________________ > Groonga-commit mailing list > Groonga-commit �� lists.sourceforge.jp > http://lists.sourceforge.jp/mailman/listinfo/groonga-commit > -- 結城 洋志 <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/