lib/picky/cores.rb in picky-3.1.0 vs lib/picky/cores.rb in picky-3.1.1

- old
+ new

@@ -21,9 +21,16 @@ raise "Block argument needed when running Cores.forked" unless block_given? ary_or_generator = ary_or_generator.sort_by { rand } if options[:randomly] generator = ary_or_generator.each + # Don't fork if there's just one element. + # + if generator.inject(0) { |total, element| total + 1 } == 1 + yield generator.next + return + end + # Get the maximum number of processors. # max = max_processors options currently_processing = 0 \ No newline at end of file