Class: Pubid::Plateau::Identifier
- Inherits:
-
Identifier
- Object
- Lutaml::Model::Serializable
- Identifier
- Pubid::Plateau::Identifier
- Defined in:
- lib/pubid/plateau/identifiers/base.rb
Overview
Base class for all PLATEAU identifiers. Canonical name Pubid::Plateau::Identifier.
Direct Known Subclasses
Pubid::Plateau::Identifiers::Handbook, Pubid::Plateau::Identifiers::TechnicalReport
Class Method Summary collapse
-
.parse(identifier) ⇒ Object
Delegate to the flavor module so callers can use
Pubid::Plateau::Identifier.parseconsistently with other flavors.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#base_hash ⇒ Object
Include type_string and annex in serialization for round-trip compatibility.
- #formatted_annex ⇒ Object
- #formatted_number ⇒ Object
-
#type_string ⇒ Object
Subclasses must implement type_string.
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, #to_urn, #urn_supplement_type, #urn_type_code, #year
Constructor Details
This class inherits a constructor from Pubid::Identifier
Class Method Details
Instance Method Details
#==(other) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/pubid/plateau/identifiers/base.rb', line 35 def ==(other) return false unless other.class == self.class number == other.number && annex == other.annex end |
#base_hash ⇒ Object
Include type_string and annex in serialization for round-trip compatibility
43 44 45 46 47 48 49 50 51 |
# File 'lib/pubid/plateau/identifiers/base.rb', line 43 def base_hash hash = super if self.class.attributes.key?(:type_string) && type_string hash[:type] = type_string end hash[:annex] = annex if annex hash end |
#formatted_annex ⇒ Object
31 32 33 |
# File 'lib/pubid/plateau/identifiers/base.rb', line 31 def formatted_annex annex ? "-#{annex}" : "" end |
#formatted_number ⇒ Object
27 28 29 |
# File 'lib/pubid/plateau/identifiers/base.rb', line 27 def formatted_number "#%02d" % number end |
#type_string ⇒ Object
Subclasses must implement type_string
23 24 25 |
# File 'lib/pubid/plateau/identifiers/base.rb', line 23 def type_string raise NotImplementedError, "Subclasses must implement type_string" end |