Class: Pubid::Iho::Identifiers::Base
- Inherits:
-
Pubid::Identifier
- Object
- Lutaml::Model::Serializable
- Pubid::Identifier
- Pubid::Iho::Identifiers::Base
- Defined in:
- lib/pubid/iho/identifiers/base.rb
Overview
Base class for all IHO identifiers.
IHO identifiers have the form:
IHO {S|P|M|B|C}-{code}[ Ap. {appendix}][ Part {part}][ Annex {annex}][ Suppl {supplement}][ {version}]
The leading IHO publisher prefix is optional on input but always emitted on output.
Direct Known Subclasses
Bibliographic, CircularLetter, Miscellaneous, Publication, Standard
Class Method Summary collapse
Instance Method Summary collapse
-
#to_s ⇒ String
Render the identifier as a string in canonical IHO form.
Methods inherited from Pubid::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_supplement_s, #to_urn, #urn_supplement_type, #urn_type_code
Constructor Details
This class inherits a constructor from Pubid::Identifier
Class Method Details
.parse(string) ⇒ Object
22 23 24 |
# File 'lib/pubid/iho/identifiers/base.rb', line 22 def self.parse(string) Iho::Identifier.parse(string) end |
Instance Method Details
#to_s ⇒ String
Render the identifier as a string in canonical IHO form.
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/pubid/iho/identifiers/base.rb', line 28 def to_s letter = type.is_a?(Hash) ? type[:short].to_s : type.to_s rendered = "#{publisher} #{letter}-#{code}" rendered << " Ap. #{appendix}" if appendix rendered << " Part #{part}" if part rendered << " Annex #{annex}" if annex rendered << " Suppl #{supplement}" if supplement rendered << " #{version}" if version rendered end |