Class: Omnizip::AlgorithmRegistry

Inherits:
Registry
  • Object
show all
Defined in:
lib/omnizip/algorithm_registry.rb

Constant Summary collapse

BUILTIN_ALGORITHMS =
{
  lzma: "Omnizip::Algorithms::LZMA",
  lzma2: "Omnizip::Algorithms::LZMA2",
  ppmd7: "Omnizip::Algorithms::PPMd7",
  ppmd8: "Omnizip::Algorithms::PPMd8",
  bzip2: "Omnizip::Algorithms::BZip2",
  deflate: "Omnizip::Algorithms::Deflate",
  deflate64: "Omnizip::Algorithms::Deflate64",
  zstandard: "Omnizip::Algorithms::Zstandard",
}.freeze

Class Method Summary collapse

Class Method Details

.labelObject



37
38
39
# File 'lib/omnizip/algorithm_registry.rb', line 37

def label
  "Algorithm"
end

.not_found_error_classObject



33
34
35
# File 'lib/omnizip/algorithm_registry.rb', line 33

def not_found_error_class
  Omnizip::UnknownAlgorithmError
end

.register(name, klass) ⇒ Object

Raises:

  • (ArgumentError)


41
42
43
44
45
46
# File 'lib/omnizip/algorithm_registry.rb', line 41

def register(name, klass)
  raise ArgumentError, "Algorithm name cannot be nil" if name.nil?
  raise ArgumentError, "Algorithm class cannot be nil" if klass.nil?

  super
end