Module: Pubid::CenCenelec::Identifier

Extended by:
IdentifierFacade
Included in:
Pubid::CenCenelec::Identifiers::Base, SingleIdentifier
Defined in:
lib/pubid/cen_cenelec/identifier.rb

Overview

‘extend Pubid::IdentifierFacade` adds polymorphic `from_hash` and pairs with `include Pubid::CenCenelec::Identifier` in Identifiers::Base for identity (`is_a?`/`===`), so a consumer handed this module can deserialize and identity-check CEN/CENELEC ids through it.

Class Method Summary collapse

Methods included from IdentifierFacade

from_hash, polymorphic_type_map

Class Method Details

.parse(identifier) ⇒ Object



13
14
15
16
17
18
# File 'lib/pubid/cen_cenelec/identifier.rb', line 13

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