Class: Pubid::Cie::Identifier

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/pubid/cie/identifier.rb

Overview

Base Identifier class for CIE Provides parse() entry point

Direct Known Subclasses

SingleIdentifier, SupplementIdentifier

Constant Summary collapse

TYPE_KEY_TO_KLASS =

Factory that builds a CIE identifier from a hash of primitives. Dispatch on ‘:type` to a SingleIdentifier subclass; default is Pubid::Cie::Identifiers::Standard.

{
  standard:        "Standard",
  conference:      "Conference",
  bundle:          "Bundle",
  joint_published: "JointPublished",
  dual_published:  "DualPublished",
  identical:       "Identical",
  tutorial_bundle: "TutorialBundle",
}.freeze

Class Method Summary collapse

Class Method Details

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



30
31
32
33
# File 'lib/pubid/cie/identifier.rb', line 30

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

.parse(input) ⇒ Object

Parse CIE identifier string



11
12
13
14
15
# File 'lib/pubid/cie/identifier.rb', line 11

def self.parse(input)
  parsed = Parser.parse(input)
  builder = Builder.new
  builder.build(parsed, original_string: input)
end