Class Stream::ReversedStream
In: lib/stream.rb
Parent: WrappedStream

Each reversable stream (a stream that implements backward and at_beginning?) can be wrapped by a ReversedStream.

A ReversedStream is created by the method reverse:

 (1..6).create_stream.reverse.to_a ==> [6, 5, 4, 3, 2, 1]

Methods

Public Class methods

Create a reversing wrapper for the reversable stream otherStream. If otherStream does not support backward moving a NotImplementedError is signaled on the first backward move.

Public Instance methods

Returns true if the wrapped stream is at_end?.

Returns true if the wrapped stream is at_beginning?.

Moves the wrapped stream one step forward.

Moves the wrapped stream one step backward.

Sets the wrapped stream to the end.

Sets the wrapped stream to the beginning.

[Validate]