Class: Pubid::Iala::Identifier
- Inherits:
-
Pubid::Identifier
- Object
- Lutaml::Model::Serializable
- Pubid::Identifier
- Pubid::Iala::Identifier
- Defined in:
- lib/pubid/iala/identifier.rb
Overview
Base class for all IALA identifiers. Canonical name Pubid::Iala::Identifier; every concrete IALA identifier (Identifiers::*) descends from it.
IALA identifiers have the form:
[IALA ]{S|R|G|M|C|X|P}<4-digit number>[-<subpart>][ Ed <edition>][ (<LangLetter>)]
Examples:
S1070
IALA S1070 Ed 2.0
R1016:ed2.0(F)
C0103-1 Ed 3.0
Direct Known Subclasses
Pubid::Iala::Identifiers::Advice, Pubid::Iala::Identifiers::Annex, Pubid::Iala::Identifiers::GeneralAssembly, Pubid::Iala::Identifiers::Guideline, Pubid::Iala::Identifiers::Letter, Pubid::Iala::Identifiers::Manual, Pubid::Iala::Identifiers::ModelCourse, Pubid::Iala::Identifiers::Recommendation, Pubid::Iala::Identifiers::Report, Pubid::Iala::Identifiers::Resolution, Pubid::Iala::Identifiers::Standard
Constant Summary collapse
- IALA_TYPE_MAP =
{ "pubid:iala:standard" => "Pubid::Iala::Identifiers::Standard", "pubid:iala:recommendation" => "Pubid::Iala::Identifiers::Recommendation", "pubid:iala:guideline" => "Pubid::Iala::Identifiers::Guideline", "pubid:iala:manual" => "Pubid::Iala::Identifiers::Manual", "pubid:iala:model-course" => "Pubid::Iala::Identifiers::ModelCourse", "pubid:iala:advice" => "Pubid::Iala::Identifiers::Advice", "pubid:iala:general-assembly" => "Pubid::Iala::Identifiers::GeneralAssembly", "pubid:iala:letter" => "Pubid::Iala::Identifiers::Letter", "pubid:iala:annex" => "Pubid::Iala::Identifiers::Annex", "pubid:iala:report" => "Pubid::Iala::Identifiers::Report", "pubid:iala:resolution" => "Pubid::Iala::Identifiers::Resolution", }.freeze
Class Attribute Summary collapse
-
.canonical_dotted_segment_width ⇒ Object
readonly
Zero-pad each dotted continuation segment of the number to this width.
-
.canonical_number_width ⇒ Object
readonly
Zero-pad the leading numeric run of the document number to this width.
Class Method Summary collapse
-
.parse(identifier) ⇒ Pubid::Iala::Identifier
Parse an IALA identifier string into an identifier object.
Instance Method Summary collapse
- #to_urn ⇒ Object
-
#type_letter ⇒ Object
Single-letter type code (S, R, G, …) — convenience accessor used by Renderer and UrnGenerator.
Methods inherited from Pubid::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 Attribute Details
.canonical_dotted_segment_width ⇒ Object (readonly)
Zero-pad each dotted continuation segment of the number to this width. nil means preserve verbatim. Only GeneralAssembly (GA) sets this today — its series.index form (01.01, 01.13) is the canonical cover-page shape.
77 78 79 |
# File 'lib/pubid/iala/identifier.rb', line 77 def canonical_dotted_segment_width @canonical_dotted_segment_width end |
.canonical_number_width ⇒ Object (readonly)
Zero-pad the leading numeric run of the document number to this
width. nil means preserve the input verbatim. Subclasses declare
their canonical IALA cover-page form via number_width (e.g.
Standard declares 4 → M0001; GeneralAssembly declares 2 → GA01).
The builder consults this instead of branching on type_letter.
71 72 73 |
# File 'lib/pubid/iala/identifier.rb', line 71 def canonical_number_width @canonical_number_width end |
Class Method Details
.parse(identifier) ⇒ Pubid::Iala::Identifier
Parse an IALA identifier string into an identifier object.
22 23 24 25 26 27 |
# File 'lib/pubid/iala/identifier.rb', line 22 def self.parse(identifier) parsed = Parser.parse(identifier) Builder.build(parsed) rescue Parslet::ParseFailed => e raise "Failed to parse IALA identifier '#{identifier}': #{e.}" end |
Instance Method Details
#to_urn ⇒ Object
55 56 57 |
# File 'lib/pubid/iala/identifier.rb', line 55 def to_urn UrnGenerator.new(self).generate end |
#type_letter ⇒ Object
Single-letter type code (S, R, G, …) — convenience accessor used by Renderer and UrnGenerator.
61 62 63 |
# File 'lib/pubid/iala/identifier.rb', line 61 def type_letter self.class.type[:short] end |