Class: Pubid::CenCenelec::Identifiers::AdoptedEuropeanNorm

Inherits:
EuropeanNorm show all
Defined in:
lib/pubid/cen_cenelec/identifiers/adopted_european_norm.rb

Overview

AdoptedEuropeanNorm wraps ISO/IEC identifiers Example: “EN ISO 8601:2019” where ISO 8601:2019 is an ISO identifier object

Constant Summary

Constants inherited from EuropeanNorm

EuropeanNorm::TYPED_STAGES

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SingleIdentifier

#<=>

Methods included from Pubid::CenCenelec::Identifier

parse

Methods included from IdentifierFacade

#from_hash, #polymorphic_type_map

Methods inherited from 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

.typeObject

Override self.type to return nil so that AdoptedEuropeanNorm is NOT registered as a type in CenCenelec.identifier_types. The class is a polymorphic wrapper that wraps an adopted ISO/IEC identifier under an EN publisher; it is constructed explicitly by Builder#build_adopted_identifier, not selected via type-code lookup. Returning nil here prevents identifier_types auto-discovery from shadowing EuropeanNorm (which also reports :en) in CenCenelec.locate_type(:en).



18
19
20
# File 'lib/pubid/cen_cenelec/identifiers/adopted_european_norm.rb', line 18

def self.type
  nil
end

Instance Method Details

#dateObject



35
36
37
# File 'lib/pubid/cen_cenelec/identifiers/adopted_european_norm.rb', line 35

def date
  adopted_identifier&.date if adopted_identifier&.methods&.include?(:date)
end

#numberObject

Delegate common methods to adopted identifier



27
28
29
# File 'lib/pubid/cen_cenelec/identifiers/adopted_european_norm.rb', line 27

def number
  adopted_identifier&.number
end

#partObject



43
44
45
# File 'lib/pubid/cen_cenelec/identifiers/adopted_european_norm.rb', line 43

def part
  adopted_identifier&.part if adopted_identifier&.methods&.include?(:part)
end

#partsObject



39
40
41
# File 'lib/pubid/cen_cenelec/identifiers/adopted_european_norm.rb', line 39

def parts
  adopted_identifier&.parts if adopted_identifier&.methods&.include?(:parts)
end

#to_s(**opts) ⇒ Object



22
23
24
# File 'lib/pubid/cen_cenelec/identifiers/adopted_european_norm.rb', line 22

def to_s(**opts)
  render(format: :human, **opts)
end

#yearObject



31
32
33
# File 'lib/pubid/cen_cenelec/identifiers/adopted_european_norm.rb', line 31

def year
  adopted_identifier&.year if adopted_identifier&.methods&.include?(:year)
end