Module: Pubid::Amca::Identifier

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

Overview

NOTE: this flavor intentionally does NOT ‘extend Pubid::IdentifierFacade` (nor include it in Identifiers::Base). The facade’s identity check makes ‘is_a?(<Flavor>::Identifier)` true, which routes the object through a consumer’s ‘to_hash` (e.g. relaton-index#save) — but AMCA’s ‘to_hash` currently raises (publisher is stored as a String, not a Publisher component). Enabling the facade here would turn a non-crashing path into a crash. Re-enable once AMCA serialization round-trips cleanly.

Class Method Summary collapse

Class Method Details

.parse(identifier) ⇒ Pubid::Amca::Identifier

Parse an ACMA identifier string into an identifier object

Parameters:

  • identifier (String)

    The ACMA identifier string to parse

Returns:

Raises:

  • (Parslet::ParseFailed)

    If parsing fails



17
18
19
20
21
22
# File 'lib/pubid/amca/identifier.rb', line 17

def self.parse(identifier)
  parsed = Parser.parse(identifier)
  Builder.build(parsed)
rescue Parslet::ParseFailed => e
  raise "Failed to parse ACMA identifier '#{identifier}': #{e.message}"
end