Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/astromapper/extensions/array.rb

Instance Method Summary collapse

Instance Method Details

#roll(n = 1) ⇒ Object



2
3
4
# File 'lib/astromapper/extensions/array.rb', line 2

def roll(n=1)
  n.times.map{ self.rotate!; self.first }.inject{|s,x| s + x}
end