Methods

Files

Tins::Rotate

Public Instance Methods

rotate(n = 1) click to toggle source
# File lib/tins/rotate.rb, line 12
def rotate(n = 1)
  clone.rotate!(n)
end
rotate!(n = 1) click to toggle source
# File lib/tins/rotate.rb, line 3
def rotate!(n = 1)
  if n >= 0
    n.times { push shift }
  else
    (-n).times { unshift pop }
  end
  self
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.