Class: CZTop::Z85::Pipe::Strategy::Sequential

Inherits:
CZTop::Z85::Pipe::Strategy show all
Defined in:
lib/cztop/z85/pipe.rb

Overview

A single thread that is either reading input, encoding/decoding, or writing output.

Instance Method Summary collapse

Methods inherited from CZTop::Z85::Pipe::Strategy

#initialize

Constructor Details

This class inherits a constructor from CZTop::Z85::Pipe::Strategy

Instance Method Details

#executeObject

Runs the algorithm.

Raises:

  • (void)


102
103
104
105
106
107
108
109
110
111
# File 'lib/cztop/z85/pipe.rb', line 102

def execute
  previous_chunk = nil
  while true
    chunk = @source.read(@read_sz)
    @sink << @xcode.call(chunk, previous_chunk)
    break if chunk.nil?

    previous_chunk = chunk
  end
end