Class: Pubid::Adobe::Identifier
- Inherits:
-
Identifier
- Object
- Lutaml::Model::Serializable
- Identifier
- Pubid::Adobe::Identifier
- Defined in:
- lib/pubid/adobe/identifier.rb
Overview
Base class for all Adobe identifiers. Canonical name Pubid::Adobe::Identifier; every concrete Adobe identifier (Identifiers::*) descends from it.
Adobe identifiers come in two shapes:
* TechNote — `Adobe Technical Note #<number>` / `ATN<number>`
e.g. `Adobe Technical Note #5014`, `ATN5014`.
* Publication — slug-keyed named specs that have no number
e.g. `adobe-glyph-list`, `adobe-japan1-7`.
Direct Known Subclasses
Pubid::Adobe::Identifiers::Publication, Pubid::Adobe::Identifiers::TechNote
Constant Summary collapse
- ADOBE_TYPE_MAP =
{ "pubid:adobe:tech-note" => "Pubid::Adobe::Identifiers::TechNote", "pubid:adobe:publication" => "Pubid::Adobe::Identifiers::Publication", }.freeze
Class Method Summary collapse
-
.parse(identifier) ⇒ Pubid::Adobe::Identifier
Parse an Adobe identifier string into an identifier object.
Instance Method Summary collapse
- #to_urn ⇒ Object
-
#type_short ⇒ Object
Short type code (e.g. "ATN", nil for Publication) — convenience accessor used by Renderer and UrnGenerator.
Methods inherited from Identifier
apply_mappings, #base, #base_document, concrete_class_for, #dated_version_of?, #draft_of?, #drop_supplements, #edition_of?, #eql?, #exclude, from_hash, #has_supplement?, #hash, #includes?, #initialize, #matches?, #mr_all_parts, #mr_edition, #mr_languages, #mr_number, #mr_number_with_part, #mr_part, #mr_publisher, #mr_subpart, #mr_supplement_suffix, #mr_type, #mr_year, #new_edition_of?, polymorphic_name, polymorphic_type_map, #related_to?, #render, #resolve_urn_generator, #root, #sibling_of?, #supplement_of?, #to_hash, #to_mr_string, #to_s, #to_slug, #to_supplement_s, #urn_supplement_type, #urn_type_code, #year
Constructor Details
This class inherits a constructor from Pubid::Identifier
Class Method Details
.parse(identifier) ⇒ Pubid::Adobe::Identifier
Parse an Adobe identifier string into an identifier object.
20 21 22 23 24 25 |
# File 'lib/pubid/adobe/identifier.rb', line 20 def self.parse(identifier) parsed = Parser.parse(identifier) Builder.build(parsed) rescue Parslet::ParseFailed => e raise "Failed to parse Adobe identifier '#{identifier}': #{e.}" end |
Instance Method Details
#to_urn ⇒ Object
38 39 40 |
# File 'lib/pubid/adobe/identifier.rb', line 38 def to_urn UrnGenerator.new(self).generate end |
#type_short ⇒ Object
Short type code (e.g. "ATN", nil for Publication) — convenience accessor used by Renderer and UrnGenerator.
44 45 46 |
# File 'lib/pubid/adobe/identifier.rb', line 44 def type_short self.class.type[:short] end |