Kouhei Sutou
kou****@clear*****
Mon Oct 7 18:48:40 JST 2013
パラメーターが多くなってきたので、Hashじゃなくてオブジェクト にしてしまった方がいいかもしれないですねぇ。 私はこんな感じでオブジェクトにしています。 https://github.com/groonga/groonga-query-log/blob/master/lib/groonga/query-log/memory-leak-detector.rb#L86 In <6a09303d0a47d59a5c5e81c8748c866ebd739042 �� jenkins.clear-code.com> "[Groonga-commit] droonga/http-benchmark �� 6a09303 [master] Store parameters to a local variable for other methods" on Mon, 07 Oct 2013 18:30:51 +0900, YUKI Hiroshi <null+groonga �� clear-code.com> wrote: > YUKI Hiroshi 2013-10-07 18:30:51 +0900 (Mon, 07 Oct 2013) > > New Revision: 6a09303d0a47d59a5c5e81c8748c866ebd739042 > https://github.com/droonga/http-benchmark/commit/6a09303d0a47d59a5c5e81c8748c866ebd739042 > > Message: > Store parameters to a local variable for other methods > > Modified files: > lib/droonga/http-benchmark/gradual-runner.rb > > Modified: lib/droonga/http-benchmark/gradual-runner.rb (+2 -1) > =================================================================== > --- lib/droonga/http-benchmark/gradual-runner.rb 2013-10-07 18:28:55 +0900 (41680cb) > +++ lib/droonga/http-benchmark/gradual-runner.rb 2013-10-07 18:30:51 +0900 (743ba28) > @@ -15,6 +15,7 @@ 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 > + @params = params > end > > def run > @@ -26,7 +27,7 @@ module Droonga > def run_benchmarks > @results = {} > @start_n_clients.step(@end_n_clients, @step) do |n_clients| > - benchmark = Runner.new(params.merge(:n_clients => n_clients)) > + benchmark = Runner.new(@params.merge(:n_clients => n_clients)) > @results[n_clients] = benchmark.run > end > end