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)

90
91
92
93
94
95
96
97
98
# File 'lib/cztop/z85/pipe.rb', line 90

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