Class: Nodectl::Stream::FileWithMemory
- Defined in:
- lib/nodectl/stream/file_with_memory.rb
Instance Method Summary collapse
-
#initialize(file, options = {}) ⇒ FileWithMemory
constructor
A new instance of FileWithMemory.
- #onread(&blk) ⇒ Object
- #onread_call(chunk) ⇒ Object
Methods inherited from File
#close, #closed?, #onclose, #read_chunk
Constructor Details
#initialize(file, options = {}) ⇒ FileWithMemory
Returns a new instance of FileWithMemory.
2 3 4 5 6 |
# File 'lib/nodectl/stream/file_with_memory.rb', line 2 def initialize(file, = {}) super(file, ) @memory = "" end |
Instance Method Details
#onread(&blk) ⇒ Object
8 9 10 11 |
# File 'lib/nodectl/stream/file_with_memory.rb', line 8 def onread(&blk) blk.call(@memory) @onread << blk end |
#onread_call(chunk) ⇒ Object
13 14 15 16 |
# File 'lib/nodectl/stream/file_with_memory.rb', line 13 def onread_call(chunk) @memory << chunk super(chunk) end |