Class: Pubid::Ieee::Ire::Identifier
- Inherits:
-
Pubid::Ieee::Identifier
- Object
- Lutaml::Model::Serializable
- Pubid::Identifier
- Pubid::Ieee::Identifier
- Pubid::Ieee::Ire::Identifier
- Includes:
- Pubid::Ieee::Identifiers::CodeNumber
- Defined in:
- lib/pubid/ieee/ire/identifier.rb
Overview
IRE identifiers (Institute of Radio Engineers: 1912-1963).
Reparented onto Pubid::Ieee::Identifier + the CodeNumber mixin for the
same reasons AIEE was (see Pubid::Ieee::Aiee::Identifier): descending
from bare Lutaml::Model::Serializable left IRE without #root (relaton
keys its index on id.root.number.to_s -> NoMethodError), without a
polymorphic _type (so from_hash could not route back), and — because
an IRE object was not a ::Pubid::Identifier — unassignable to
Identifiers::AdoptedStandard#adopted_identifiers, which raised
Lutaml::Model::IncorrectModelError on to_hash for the IRE-adopted
forms ("IEEE Std 159-1972 (52 IRE 7 S2)").
The document designation ("7.S2") is carried in the shared code_obj
and serialized as the flat split columns (number/prefix/parts/
separator); the publication year uses the base's plain :string year
(IRE previously declared its own :integer one, which would collide).
Instance Attribute Summary
Attributes inherited from Pubid::Ieee::Identifier
Class Method Summary collapse
-
.parse(input) ⇒ Object
Parse IRE identifier string.
-
.polymorphic_name ⇒ Object
A distinct polymorphic name so from_hash routes to IRE.
Instance Method Summary collapse
Methods included from Pubid::Ieee::Identifiers::CodeNumber
#code_obj, included, #initialize, #rebuild_code_obj_from_split, #sync_split_from_code_obj
Methods inherited from Pubid::Ieee::Identifier
additional_identifier_classes, #code, #draft, #draft_month, #exclude, from_hash, #initialize, #mr_number_with_part, #mr_publisher, #mr_type, #mr_year, parse_single, #publisher, #to_hash
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_type_map, #related_to?, #render, #resolve_urn_generator, #root, #sibling_of?, #supplement_of?, #to_hash, #to_mr_string, #to_slug, #to_supplement_s, #to_urn, #urn_supplement_type, #urn_type_code, #year
Class Method Details
.parse(input) ⇒ Object
Parse IRE identifier string
41 42 43 44 45 |
# File 'lib/pubid/ieee/ire/identifier.rb', line 41 def self.parse(input) parsed = Parser.new.parse(input) builder = Builder.new builder.build(parsed) end |
.polymorphic_name ⇒ Object
A distinct polymorphic name so from_hash routes to IRE. The derived default (last name segment "Identifier") would be "pubid:ieee:identifier", colliding with the base class.
36 37 38 |
# File 'lib/pubid/ieee/ire/identifier.rb', line 36 def self.polymorphic_name "pubid:ieee:ire" end |
Instance Method Details
#to_s(trademark: false) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/pubid/ieee/ire/identifier.rb', line 47 def to_s(trademark: false) # Year comes FIRST in IRE format - render as 2-digit short year result = [(short_year if year), publisher, type, code&.to_s] .compact.join(" ") # The code is the last token, so the end of the string already *is* # the code boundary — but the symbol is picked from the code, not by # scanning the string (which starts with the year). if trademark result += Pubid::Ieee.trademark_symbol_for(code_obj&.number, code_obj&.prefix, publishers: [publisher]) end result end |