Class: Stream::WrappedStream

Inherits:
BasicStream show all
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]

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#create_stream

Constructor Details

#initialize(otherStream) ⇒ WrappedStream

Create a new WrappedStream wrapping the Stream otherStream.



214
215
216
# File 'lib/stream.rb', line 214

def initialize (otherStream)
  @wrapped_stream = otherStream
end

Instance Attribute Details

#wrapped_streamObject (readonly)

Returns the value of attribute wrapped_stream.



211
212
213
# File 'lib/stream.rb', line 211

def wrapped_stream
  @wrapped_stream
end

Instance Method Details

#at_beginning?Boolean

Returns:

  • (Boolean)


218
# File 'lib/stream.rb', line 218

def at_beginning?; @wrapped_stream.at_beginning?; end

#at_end?Boolean

Returns:

  • (Boolean)


219
# File 'lib/stream.rb', line 219

def at_end?; @wrapped_stream.at_end?; end

#basic_backwardObject



229
# File 'lib/stream.rb', line 229

def basic_backward;  @wrapped_stream.basic_backward; end

#basic_forwardObject



228
# File 'lib/stream.rb', line 228

def basic_forward; @wrapped_stream.basic_forward; end

#set_to_beginObject



222
# File 'lib/stream.rb', line 222

def set_to_begin; @wrapped_stream.set_to_begin; end

#set_to_endObject



221
# File 'lib/stream.rb', line 221

def set_to_end; @wrapped_stream.set_to_end; end

#unwrappedObject

Returns the wrapped stream unwrapped.



225
# File 'lib/stream.rb', line 225

def unwrapped; @wrapped_stream.unwrapped; end