Class: Pubid::Iho::Scheme

Inherits:
Scheme
  • Object
show all
Defined in:
lib/pubid/iho/scheme.rb

Overview

Scheme registry for IHO identifier types.

Constant Summary collapse

IDENTIFIERS =
[
  Identifiers::Standard,
  Identifiers::Publication,
  Identifiers::Miscellaneous,
  Identifiers::Bibliographic,
  Identifiers::CircularLetter,
].freeze

Instance Attribute Summary

Attributes inherited from Scheme

#identifiers, #languages, #publishers, #stages, #supplement_identifiers, #types

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Scheme

#all_identifier_classes, #all_typed_stages, #configure, #identifier_class_index, #locate_identifier_klass_by_type_code, #locate_typed_stage_by_abbr, #locate_typed_stage_by_harmonized_code, #locate_typed_stage_by_stage_code, #supplement_typed_stages, #typed_stage_index, #typed_stages

Constructor Details

#initializeScheme

Returns a new instance of Scheme.



15
16
17
# File 'lib/pubid/iho/scheme.rb', line 15

def initialize
  @identifiers = IDENTIFIERS
end

Class Method Details

.identifier_klass_for_type_letter(letter) ⇒ Class<Identifiers::Base>

Look up an identifier class by its IHO series letter (S/P/M/B/C).

Parameters:

  • letter (String)

Returns:

Raises:

  • (KeyError)

    if the letter is not a known IHO series



23
24
25
26
# File 'lib/pubid/iho/scheme.rb', line 23

def self.identifier_klass_for_type_letter(letter)
  @by_letter ||= IDENTIFIERS.to_h { |klass| [klass.type[:short], klass] }
  @by_letter.fetch(letter.to_s)
end