X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=doc%2Fclasses%2FArray.html;fp=doc%2Fclasses%2FArray.html;h=0000000000000000000000000000000000000000;hb=7c9314f502cde8daad23b61d10b24a542e04154a;hp=4cdc19fc2260150298b278d26561cfd763891460;hpb=d1f1649ba43c5cbc43c4beb2380096ba051d646a;p=packages%2Fprecise%2Fmcollective.git diff --git a/doc/classes/Array.html b/doc/classes/Array.html deleted file mode 100644 index 4cdc19f..0000000 --- a/doc/classes/Array.html +++ /dev/null @@ -1,181 +0,0 @@ - - - - -
-Class | -Array | -
In: | -
-
- lib/mcollective/monkey_patches.rb
-
- - |
-
Parent: | -- Object - | -
-a method # that walks an array in groups, pass a block to call the block on -each sub array -
- -- # File lib/mcollective/monkey_patches.rb, line 29 -29: def in_groups_of(chunk_size, padded_with=nil, &block) -30: arr = self.clone -31: -32: # how many to add -33: padding = chunk_size - (arr.size % chunk_size) -34: -35: # pad at the end -36: arr.concat([padded_with] * padding) unless padding == chunk_size -37: -38: # how many chunks we'll make -39: count = arr.size / chunk_size -40: -41: # make that many arrays -42: result = [] -43: count.times {|s| result << arr[s * chunk_size, chunk_size]} -44: -45: if block_given? -46: result.each_with_index do |a, i| -47: case block.arity -48: when 1 -49: yield(a) -50: when 2 -51: yield(a, (i == result.size - 1)) -52: else -53: raise "Expected 1 or 2 arguments, got #{block.arity}" -54: end -55: end -56: else -57: result -58: end -59: end --