lib/rgot/m.rb in rgot-0.1.0 vs lib/rgot/m.rb in rgot-0.1.1
- old
+ new
@@ -14,10 +14,11 @@
# Ruby-2.0.0 wants default value of keyword_argument
def initialize(tests: nil, benchmarks: nil, examples: nil, opts: Options.new)
raise ArgumentError, "missing keyword: tests" unless tests
raise ArgumentError, "missing keyword: benchmarks" unless benchmarks
raise ArgumentError, "missing keyword: examples" unless examples
- @cpu_list = (opts.cpu || "#{Etc.nprocessors}").split(',').map { |i|
+ cpu = opts.cpu || "#{Etc.respond_to?(:nprocessors) ? Etc.nprocessors : "1"}"
+ @cpu_list = cpu.split(',').map { |i|
j = i.to_i
raise Rgot::OptionError, "invalid value #{i.inspect} for --cpu" unless 0 < j
j
}
@thread_list = (opts.thread || "1").split(',').map { |i|