class CZTop::Z85::Pipe::Strategy
@abstract Different encoding/decoding strategies (algorithms).
This is mainly just for me to practice the GoF Strategy
Pattern.
Public Class Methods
new(source, sink, read_sz, &xcode)
click to toggle source
@param source [IO] the source @param sink [IO] the sink @param read_sz [Integer] chunk size when reading from source @param xcode [Proc] block to encode or decode data @yieldparam chunk [String, nil] current chunk (or nil
after the
last one)
@yieldparam prev_chunk [String, nil] previous chunk (or nil
for
the first time)
@yieldreturn [String] encoded/decoded chunk to write to sink
# File lib/cztop/z85/pipe.rb, line 73 def initialize(source, sink, read_sz, &xcode) @source = source @sink = sink @read_sz = read_sz @xcode = xcode end
Public Instance Methods
execute()
click to toggle source
@abstract Runs the algorithm. @raise [void]
# File lib/cztop/z85/pipe.rb, line 83 def execute() raise NotImplementedError end