lib/rbbt/util/misc/development.rb in rbbt-util-5.14.37 vs lib/rbbt/util/misc/development.rb in rbbt-util-5.14.38

- old
+ new

@@ -274,11 +274,11 @@ puts "Tick ellapsed: #{ellapsed.to_i} s. #{(ellapsed * 1000).to_i - ellapsed.to_i * 1000} ms" $_last_time_tick = Time.now end end - def self.bootstrap(elems, num = :current, file = nil, &block) + def self.bootstrap(elems, num = :current, file = nil, options = {}, &block) num = :current if num.nil? cpus = case num when :current 10 when String @@ -289,11 +289,14 @@ else 32000 / num end end + + options = Misc.add_defaults options, :cpus => cpus, :bar => "Bootstrap in #{ cpus } cpus: #{ Misc.fingerprint Annotated.purge(elems) }", :into => Set.new + index = (0..elems.length-1).to_a.collect{|v| v.to_s } - TSV.traverse index, :cpus => cpus, :bar => "Bootstrap in #{ cpus } cpus: #{ Misc.fingerprint Annotated.purge(elems) }", :into => Set.new do |pos| + TSV.traverse index, options do |pos| elem = elems[pos.to_i] elems.annotate elem if elems.respond_to? :annotate begin yield elem rescue Interrupt