Module: Pubid::Nist::Identifier

Defined in:
lib/pubid/nist/identifier.rb

Overview

NIST factory entry point. ‘.parse` lives on `Pubid::Nist` itself for historical reasons; this module hosts `.create` for API consistency with the other pubid flavors.

Class Method Summary collapse

Class Method Details

.create(**opts) ⇒ Object

Factory mirroring pubid 1.x’s ‘Pubid::Nist::Identifier.create` API.

Dispatch is by ‘:series` (e.g. “SP”, “FIPS”, “IR”, “HB”, “TN”) rather than a type code — NIST organises identifiers by document series. Scheme.locate_identifier_klass handles the mapping, including compound prefixes like “NBS CIRC” and special cases (CSM, CS-E, etc.).



22
23
24
25
26
27
# File 'lib/pubid/nist/identifier.rb', line 22

def self.create(**opts)
  klass = Scheme.locate_identifier_klass(
    series: opts[:series]&.to_s,
  ) || Identifiers::Base
  klass.new(**coerce_create_attrs(opts))
end

.parse(identifier) ⇒ Object

Delegate to the flavor module so callers can use ‘Pubid::Nist::Identifier.parse` consistently with other flavors.



11
12
13
# File 'lib/pubid/nist/identifier.rb', line 11

def self.parse(identifier)
  Pubid::Nist.parse(identifier)
end