A simple Iterator for iterating over a sequence of integers starting from zero up to a given upper bound. Mainly used by Stream::FilteredStream. Could be made private but if somebody needs it here it is. Is there a better name for it?
The upper bound is stored in the instance variable @stop which can be incremented dynamically by the method increment_stop.
Create a new IntervalStream with upper bound stop. stop - 1 is the last element. By default stop is zero which means that the stream is empty.
# File lib/stream.rb, line 183 def initialize (stop=0) @stop = stop - 1 set_to_begin end
# File lib/stream.rb, line 188 def at_beginning?; @pos < 0; end
# File lib/stream.rb, line 198 def basic_backward; @pos -= 1; @pos + 1; end
# File lib/stream.rb, line 197 def basic_forward; @pos += 1; end
Increment the upper bound by incr.
# File lib/stream.rb, line 195 def increment_stop (incr=1); @stop += incr; end
Generated with the Darkfish Rdoc Generator 2.