Module: Pubid::Plateau::Identifier

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

Overview

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

Class Method Summary collapse

Class Method Details

.create(type: nil, **opts) ⇒ Object

Factory that builds a PLATEAU identifier from a hash of primitives.

Dispatch on ‘:type`:

* `:handbook` (default)            → Identifiers::Handbook
* `:technical_report` / `:tr`      → Identifiers::TechnicalReport
* `:annex`                         → Identifiers::Annex

Attributes are plain integers/strings — no Component wrapping. ‘:publisher` is silently ignored (PLATEAU is hardcoded).



24
25
26
27
# File 'lib/pubid/plateau/identifier.rb', line 24

def self.create(type: nil, **opts)
  klass = resolve_create_class(type)
  klass.new(**coerce_create_attrs(opts, klass: klass))
end

.parse(identifier) ⇒ Object

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



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

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