Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/gonzui/util.rb

Instance Method Summary collapse

Instance Method Details

#devide(n) ⇒ Object



223
224
225
226
227
228
229
230
231
# File 'lib/gonzui/util.rb', line 223

def devide(n)
  if self.empty?
    []
  elsif self.length < n
    [self]
  else
    (0...(self.length / n)).map {|x| self[x * n, n] }
  end
end