Class: Stream::WrappedStream
- Inherits:
-
BasicStream
- Object
- BasicStream
- Stream::WrappedStream
- Defined in:
- lib/stream.rb
Overview
Class WrappedStream is the abstract superclass for stream classes that wrap another stream. The basic methods are simple delegated to the wrapped stream. Thus creating a WrappedStream on a CollectionStream would yield an equivalent stream:
arrayStream = [1,2,3].create_stream
arrayStream.to_a => [1,2,3]
Stream::WrappedStream.new(arrayStream).to_a => [1,2,3]
Direct Known Subclasses
ConcatenatedStream, FilteredStream, MappedStream, ReversedStream
Constant Summary
Constants included from Stream
Instance Attribute Summary collapse
-
#wrapped_stream ⇒ Object
readonly
Returns the value of attribute wrapped_stream.
Instance Method Summary collapse
- #at_beginning? ⇒ Boolean
- #at_end? ⇒ Boolean
- #basic_backward ⇒ Object
- #basic_forward ⇒ Object
-
#initialize(other_stream) ⇒ WrappedStream
constructor
Create a new WrappedStream wrapping the Stream other_stream.
- #set_to_begin ⇒ Object
- #set_to_end ⇒ Object
-
#unwrapped ⇒ Object
Returns the wrapped stream unwrapped.
Methods included from Stream
#+, #backward, #collect, #concatenate, #concatenate_collected, #create_stream, #current, #current_edge, #each, #empty?, #filtered, #first, #forward, #last, #modify, #move_backward_until, #move_forward_until, #peek, #remove_first, #remove_last, #reverse
Methods included from Enumerable
Constructor Details
#initialize(other_stream) ⇒ WrappedStream
Create a new WrappedStream wrapping the Stream other_stream.
314 315 316 |
# File 'lib/stream.rb', line 314 def initialize(other_stream) @wrapped_stream = other_stream end |
Instance Attribute Details
#wrapped_stream ⇒ Object (readonly)
Returns the value of attribute wrapped_stream.
311 312 313 |
# File 'lib/stream.rb', line 311 def wrapped_stream @wrapped_stream end |
Instance Method Details
#at_beginning? ⇒ Boolean
318 319 320 |
# File 'lib/stream.rb', line 318 def at_beginning? @wrapped_stream.at_beginning? end |
#at_end? ⇒ Boolean
322 323 324 |
# File 'lib/stream.rb', line 322 def at_end? @wrapped_stream.at_end? end |
#basic_backward ⇒ Object
343 344 345 |
# File 'lib/stream.rb', line 343 def basic_backward @wrapped_stream.basic_backward end |
#basic_forward ⇒ Object
339 340 341 |
# File 'lib/stream.rb', line 339 def basic_forward @wrapped_stream.basic_forward end |
#set_to_begin ⇒ Object
330 331 332 |
# File 'lib/stream.rb', line 330 def set_to_begin @wrapped_stream.set_to_begin end |
#set_to_end ⇒ Object
326 327 328 |
# File 'lib/stream.rb', line 326 def set_to_end @wrapped_stream.set_to_end end |
#unwrapped ⇒ Object
Returns the wrapped stream unwrapped.
335 336 337 |
# File 'lib/stream.rb', line 335 def unwrapped @wrapped_stream.unwrapped end |