class Stream::ImplicitStream

An ImplicitStream is an easy way to create a stream on the fly without defining a subclass of BasicStream. The basic methods required for a stream are defined with blocks:

s = Stream::ImplicitStream.new { |s|
           x = 0
           s.at_end_proc = proc { x == 5 }
           s.forward_proc = proc { x += 1 }
    }

s.to_a ==> [1, 2, 3, 4, 5]

Note that this stream is only partially defined since backward_proc and at_beginning_proc are not defined. It may as well be useful if only moving forward is required by the code fragment.

ImplicitStreams can be based on other streams using the method modify which is for example used in the methods for creating stream wrappers which remove the first or last element of an existing stream (see remove_first and remove_last).