Class: Omnizip::ChecksumRegistry
- Inherits:
-
Registry
- Object
- Registry
- Omnizip::ChecksumRegistry
- Defined in:
- lib/omnizip/checksum_registry.rb
Constant Summary collapse
- BUILTIN_CHECKSUMS =
{ crc32: "Omnizip::Checksums::Crc32", crc64: "Omnizip::Checksums::Crc64", }.freeze
Class Method Summary collapse
- .available ⇒ Object
- .label ⇒ Object
- .not_found_error_class ⇒ Object
- .register(name, checksum_class) ⇒ Object
Class Method Details
.available ⇒ Object
30 31 32 |
# File 'lib/omnizip/checksum_registry.rb', line 30 def available super.sort end |
.label ⇒ Object
15 16 17 |
# File 'lib/omnizip/checksum_registry.rb', line 15 def label "Checksum" end |
.not_found_error_class ⇒ Object
11 12 13 |
# File 'lib/omnizip/checksum_registry.rb', line 11 def not_found_error_class Omnizip::UnknownChecksumError end |
.register(name, checksum_class) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/omnizip/checksum_registry.rb', line 19 def register(name, checksum_class) key = normalize_key(name) existing = storage[key] if existing && existing != checksum_class raise ArgumentError, "Checksum '#{key}' is already registered" end synchronize { storage[key] = checksum_class } checksum_class end |