Class: Omnizip::AlgorithmRegistry
- Inherits:
-
Registry
- Object
- Registry
- Omnizip::AlgorithmRegistry
- 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
-
.available ⇒ Object
All builtin algorithms register lazily, so the plain storage keys are empty until each algorithm is first used.
- .label ⇒ Object
- .not_found_error_class ⇒ Object
- .register(name, klass) ⇒ Object
Class Method Details
.available ⇒ Object
All builtin algorithms register lazily, so the plain storage
keys are empty until each algorithm is first used. Listing
(e.g. the CLI's omnizip list) must show the builtins too.
44 45 46 |
# File 'lib/omnizip/algorithm_registry.rb', line 44 def available (super + BUILTIN_ALGORITHMS.keys).uniq end |
.label ⇒ Object
37 38 39 |
# File 'lib/omnizip/algorithm_registry.rb', line 37 def label "Algorithm" end |
.not_found_error_class ⇒ Object
33 34 35 |
# File 'lib/omnizip/algorithm_registry.rb', line 33 def not_found_error_class Omnizip::UnknownAlgorithmError end |
.register(name, klass) ⇒ Object
48 49 50 51 52 53 |
# File 'lib/omnizip/algorithm_registry.rb', line 48 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 |