Class: IO::LikeHelpers::Pipeline
- Inherits:
-
DelegatedIO
- Object
- AbstractIO
- DelegatedIO
- IO::LikeHelpers::Pipeline
- Defined in:
- lib/io/like_helpers/pipeline.rb
Overview
This class creates a pipeline of streams necessary to satisfy the internal needs of IO::Like:
CharacterIO >> BufferedIO >> BlockingIO >> delegate
Each segment of the pipeline is directly accessible so that the methods of IO::Like may use them as necessary.
Instance Attribute Summary collapse
-
#character_io ⇒ Object
readonly
A reference to the CharacterIO instance.
Instance Method Summary collapse
-
#blocking_io ⇒ Object
A reference to the BlockingIO delegate of the BufferedIO.
-
#concrete_io ⇒ Object
A reference to the original delegate given to the initializer of this stream.
-
#initialize(delegate, autoclose: true) ⇒ Pipeline
constructor
Creates a new intance of this class.
Methods inherited from DelegatedIO
#advise, #autoclose=, #autoclose?, #close, #close_on_exec=, #close_on_exec?, create_finalizer, #fcntl, #fdatasync, #fileno, #fsync, #inspect, #ioctl, #nonblock=, #nonblock?, #nread, #path, #pid, #pread, #pwrite, #read, #readable?, #ready?, #seek, #stat, #to_io, #tty?, #wait, #writable?, #write
Methods inherited from AbstractIO
#advise, #close, #close_on_exec=, #close_on_exec?, #closed?, #fcntl, #fdatasync, #fileno, #fsync, #ioctl, #nonblock, #nonblock=, #nonblock?, #nread, open, #path, #pid, #pread, #pwrite, #read, #readable?, #ready?, #seek, #stat, #to_io, #tty?, #wait, #writable?, #write
Constructor Details
#initialize(delegate, autoclose: true) ⇒ Pipeline
Creates a new intance of this class.
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/io/like_helpers/pipeline.rb', line 24 def initialize( delegate, autoclose: true ) raise ArgumentError, 'delegate cannot be nil' if delegate.nil? super(BufferedIO.new(BlockingIO.new(delegate, autoclose: autoclose))) @character_io = CharacterIO.new(buffered_io, blocking_io) end |
Instance Attribute Details
#character_io ⇒ Object (readonly)
A reference to the CharacterIO instance
49 50 51 |
# File 'lib/io/like_helpers/pipeline.rb', line 49 def character_io @character_io end |
Instance Method Details
#blocking_io ⇒ Object
Returns a reference to the BlockingIO delegate of the BufferedIO.
43 44 45 |
# File 'lib/io/like_helpers/pipeline.rb', line 43 def blocking_io buffered_io.delegate end |
#concrete_io ⇒ Object
Returns a reference to the original delegate given to the initializer of this stream.
54 55 56 |
# File 'lib/io/like_helpers/pipeline.rb', line 54 def concrete_io blocking_io.delegate end |