Enforce consistent whitespaces around blocks, equal signs, and in parameters in Ruby code
diff --git a/lib/rb/benchmark/benchmark.rb b/lib/rb/benchmark/benchmark.rb
index 0111ee8..c6adbc9 100644
--- a/lib/rb/benchmark/benchmark.rb
+++ b/lib/rb/benchmark/benchmark.rb
@@ -116,7 +116,7 @@
def collect_output
puts "Collecting output..."
# read from @pool until all sockets are closed
- @buffers = Hash.new { |h,k| h[k] = '' }
+ @buffers = Hash.new { |h, k| h[k] = '' }
until @pool.empty?
rd, = select(@pool)
next if rd.nil?
@@ -184,9 +184,9 @@
end
end
@report = {}
- @report[:total_calls] = call_times.inject(0.0) { |a,t| a += t }
+ @report[:total_calls] = call_times.inject(0.0) { |a, t| a += t }
@report[:avg_calls] = @report[:total_calls] / call_times.size
- @report[:total_clients] = client_times.inject(0.0) { |a,t| a += t }
+ @report[:total_clients] = client_times.inject(0.0) { |a, t| a += t }
@report[:avg_clients] = @report[:total_clients] / client_times.size
@report[:connection_failures] = connection_failures.size
@report[:connection_errors] = connection_errors.size
@@ -241,8 +241,8 @@
def tabulate(fmt, *labels_and_values)
labels = labels_and_values.map { |l| Array === l ? l.first : l }
- label_width = labels.inject(0) { |w,l| l.size > w ? l.size : w }
- labels_and_values.each do |(l,v)|
+ label_width = labels.inject(0) { |w, l| l.size > w ? l.size : w }
+ labels_and_values.each do |(l, v)|
f = fmt
l, f, c = l if Array === l
fmtstr = "%-#{label_width+1}s #{f}"
@@ -255,7 +255,7 @@
end
def resolve_const(const)
- const and const.split('::').inject(Object) { |k,c| k.const_get(c) }
+ const and const.split('::').inject(Object) { |k, c| k.const_get(c) }
end
puts "Starting server..."
diff --git a/lib/rb/benchmark/server.rb b/lib/rb/benchmark/server.rb
index 6df3fa9..45f2864 100644
--- a/lib/rb/benchmark/server.rb
+++ b/lib/rb/benchmark/server.rb
@@ -101,7 +101,7 @@
end
def resolve_const(const)
- const and const.split('::').inject(Object) { |k,c| k.const_get(c) }
+ const and const.split('::').inject(Object) { |k, c| k.const_get(c) }
end
tls = true if ARGV[0] == '-tls' and ARGV.shift