Class: MemoryIO::Stream Private
- Inherits:
-
Object
- Object
- MemoryIO::Stream
- Defined in:
- lib/memory_io/stream.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A stream tagged with the Context of the memory it accesses.
Types are handed one of these instead of the bare stream, so that a type can learn how to interpret the bytes it reads without the reading interface having to grow another argument.
Every other message is forwarded, so a stream behaves as it did before.
Instance Attribute Summary collapse
- #context ⇒ MemoryIO::Context readonly private
Instance Method Summary collapse
-
#initialize(stream, context) ⇒ Stream
constructor
private
A new instance of Stream.
- #pos ⇒ Object private
- #pos=(val) ⇒ Object private
- #read ⇒ Object private
- #write ⇒ Object private
Constructor Details
#initialize(stream, context) ⇒ Stream
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Stream.
21 22 23 24 |
# File 'lib/memory_io/stream.rb', line 21 def initialize(stream, context) @stream = stream @context = context end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name) ⇒ Object (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
44 45 46 47 48 |
# File 'lib/memory_io/stream.rb', line 44 def method_missing(name, *, &) return super unless @stream.respond_to?(name) @stream.public_send(name, *, &) end |
Instance Attribute Details
#context ⇒ MemoryIO::Context (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 |
# File 'lib/memory_io/stream.rb', line 15 def context @context end |
Instance Method Details
#pos ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
34 35 36 |
# File 'lib/memory_io/stream.rb', line 34 def pos @stream.pos end |
#pos=(val) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
38 39 40 |
# File 'lib/memory_io/stream.rb', line 38 def pos=(val) @stream.pos = val end |
#read ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 |
# File 'lib/memory_io/stream.rb', line 26 def read(*) @stream.read(*) end |
#write ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
30 31 32 |
# File 'lib/memory_io/stream.rb', line 30 def write(*) @stream.write(*) end |