Method: Sequence#move

Defined in:
lib/sequence.rb

#move(len) ⇒ Object

move position len elements, relative to the current position. A negative len will go in reverse. The (positive) amount actually moved is returned (<len if reached beginning/end).



350
351
352
353
354
355
356
# File 'lib/sequence.rb', line 350

def move(len)
  oldpos=pos
  newpos=oldpos+len
  newpos<0 and newpos=0
  goto newpos
  return (pos-oldpos).abs
end