Class: Pubid::Ieee::Identifiers::AdoptedStandard

Inherits:
Pubid::Ieee::Identifier show all
Defined in:
lib/pubid/ieee/identifiers/adopted_standard.rb

Overview

Adopted Standard Identifier IEEE's adoption of another organization's standard Example: "IEEE Standard No 18-1968 (ANSI C55.1-1968)" This means IEEE adopted ANSI's standard C55.1-1968 as their Std No 18-1968

Instance Attribute Summary

Attributes inherited from Pubid::Ieee::Identifier

#code_obj, #draft_obj

Instance Method Summary collapse

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, parse_single

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_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::Ieee::Identifier

Instance Method Details

#publisherObject



29
30
31
# File 'lib/pubid/ieee/identifiers/adopted_standard.rb', line 29

def publisher
  ieee_identifier&.publisher || "IEEE"
end

#to_hash(*args) ⇒ Object

publisher is derived from ieee_identifier (the serialized source of truth), so it must not be serialized. Emitting it breaks the canonical round-trip: the derived value is default-omitted on the parse path (publisher unset), but re-emitted after from_hash materializes the attribute default (the override then returns ieee_identifier.publisher, e.g. "AIEE", not the "IEEE" default). Drop it — ieee_identifier rebuilds it. (AdoptedStandard is always a top-level wrapper, never nested, so a to_hash-level drop is sufficient — same as JointDevelopment.)



41
42
43
44
45
# File 'lib/pubid/ieee/identifiers/adopted_standard.rb', line 41

def to_hash(*args)
  hash = super
  hash.delete("publisher") if hash.is_a?(::Hash)
  hash
end