Class: Pubid::Oiml::Identifier

Inherits:
Identifier
  • Object
show all
Defined in:
lib/pubid/oiml/identifier.rb

Direct Known Subclasses

SingleIdentifier, SupplementIdentifier

Constant Summary collapse

TYPE_KEY_TO_KLASS =

Factory mirroring pubid 1.x’s ‘Pubid::Oiml::Identifier.create` API. Default subclass is Pubid::Oiml::Identifiers::Recommendation.

{
  recommendation:    "Recommendation",
  document:          "Document",
  guide:             "Guide",
  vocabulary:        "Vocabulary",
  basic_publication: "BasicPublication",
  expert_report:     "ExpertReport",
  seminar_report:    "SeminarReport",
  annex:             "Annex",
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Identifier

#base_identifier, #eql?, #exclude, #hash, #initialize, #mr_number, #mr_number_with_part, #mr_part, #mr_publisher, #mr_type, #mr_year, #new_edition_of?, polymorphic_name, #render, #resolve_urn_generator, #root, #to_mr_string, #to_s, #to_supplement_s, #urn_supplement_type, #urn_type_code, #year

Constructor Details

This class inherits a constructor from Pubid::Identifier

Class Method Details

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



23
24
25
26
# File 'lib/pubid/oiml/identifier.rb', line 23

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

Instance Method Details

#to_urnObject



6
7
8
# File 'lib/pubid/oiml/identifier.rb', line 6

def to_urn
  UrnGenerator.new(self).generate
end