Class: ADSP::String

Inherits:
Object
  • Object
show all
Defined in:
lib/adsp/string.rb

Overview

ADSP::String class.

Direct Known Subclasses

Test::Mock::String

Constant Summary collapse

Option =

Current option class.

ADSP::Option
BUFFER_LENGTH_NAMES =

Current buffer length names. It is a part of decompressor options.

%i[destination_buffer_length].freeze

Class Method Summary collapse

Class Method Details

.compress(source, options = {}) ⇒ Object

Compresses source string using options. Option: :destination_buffer_length destination buffer length. Returns compressed string.



21
22
23
24
25
26
27
# File 'lib/adsp/string.rb', line 21

def self.compress(source, options = {})
  Validation.validate_string source

  options = self::Option.get_compressor_options options, BUFFER_LENGTH_NAMES

  native_compress_string source, options
end

.decompress(source, options = {}) ⇒ Object

Decompresses source string using options. Option: :destination_buffer_length destination buffer length. Returns decompressed string.



41
42
43
44
45
46
47
# File 'lib/adsp/string.rb', line 41

def self.decompress(source, options = {})
  Validation.validate_string source

  options = self::Option.get_decompressor_options options, BUFFER_LENGTH_NAMES

  native_decompress_string source, options
end

.native_compress_string(source, options) ⇒ Object

Internal method for compressing source string using options.



32
33
34
# File 'lib/adsp/string.rb', line 32

def self.native_compress_string(source, options)
  raise NotImplementedError
end

.native_decompress_string(source, options) ⇒ Object

Internal method for decompressing source string using options.



52
53
54
# File 'lib/adsp/string.rb', line 52

def self.native_decompress_string(source, options)
  raise NotImplementedError
end