Class: Cabriolet::Compressors::Base
- Inherits:
-
Object
- Object
- Cabriolet::Compressors::Base
- Defined in:
- lib/cabriolet/compressors/base.rb
Overview
Base class for all compression algorithms
Provides common interface and functionality for compressors. Each compressor implementation must override the compress method.
Instance Attribute Summary collapse
-
#buffer_size ⇒ Object
readonly
Returns the value of attribute buffer_size.
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#io_system ⇒ Object
readonly
Returns the value of attribute io_system.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
-
#compress ⇒ Integer
Compress the input data.
-
#initialize(io_system, input, output, buffer_size) ⇒ Base
constructor
Initialize base compressor.
Constructor Details
#initialize(io_system, input, output, buffer_size) ⇒ Base
Initialize base compressor
18 19 20 21 22 23 |
# File 'lib/cabriolet/compressors/base.rb', line 18 def initialize(io_system, input, output, buffer_size) @io_system = io_system @input = input @output = output @buffer_size = buffer_size end |
Instance Attribute Details
#buffer_size ⇒ Object (readonly)
Returns the value of attribute buffer_size.
10 11 12 |
# File 'lib/cabriolet/compressors/base.rb', line 10 def buffer_size @buffer_size end |
#input ⇒ Object (readonly)
Returns the value of attribute input.
10 11 12 |
# File 'lib/cabriolet/compressors/base.rb', line 10 def input @input end |
#io_system ⇒ Object (readonly)
Returns the value of attribute io_system.
10 11 12 |
# File 'lib/cabriolet/compressors/base.rb', line 10 def io_system @io_system end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
10 11 12 |
# File 'lib/cabriolet/compressors/base.rb', line 10 def output @output end |
Instance Method Details
#compress ⇒ Integer
Compress the input data
29 30 31 |
# File 'lib/cabriolet/compressors/base.rb', line 29 def compress raise NotImplementedError, "#{self.class} must implement #compress" end |