Iterator::Base (Class)

In: iterator.rb
Parent: Object

Base class which all iterators should derive from. It includes Ruby’s Enumerable module.

All iterators are able to move forward. However not all iterators are capable of moving backward. For instance Iterator::Continuation are forward-only.

Methods

<=>   close   current   current=   current_prev   current_prev=   each   first   has_next?   has_prev?   last   next   next1   position   prev   prev1   reverse   reverse_each  

Included Modules

Enumerable Comparable

Public Instance methods

compare positions

remember to close the door after us.

return that element we are currently pointing at

overwrite that element we are currently pointing at

return that element we are currently pointing at - 1

overwrite that element we are currently pointing at - 1

reset iterator at first element, and move forward until last-element has been reached.

Reset iterator, so that it points to the first element This method are suppose to return self.

can we move one step forward

can we move one step forward

Reset iterator, so that it points to the last element This method are suppose to return self.

Move n steps forward. This method are suppose to return self.

move one step forward

return the current position

Move n steps backwards. This method are suppose to return self.

move one step backwards

create an iterator which moves the opposite direction.

remember to invoke close when you are done.

reset iterator at last element, and move backwards until first-element has been reached.

[Validate]