Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/array_patching.rb
Instance Method Summary collapse
Instance Method Details
#each_slice(count) {|items| ... } ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/array_patching.rb', line 3 def each_slice count items = [] self.each do |item| items << item if items.length == count yield items items = [] end end yield items if items.length > 0 end |