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

#<=>, #to_s

Methods inherited from Pubid::CenCenelec::Identifier

parse

Methods inherited from Identifier

#base_identifier, #eql?, #exclude, from_hash, #hash, #initialize, #mr_number, #mr_number_with_part, #mr_part, #mr_publisher, #mr_type, #mr_year, #new_edition_of?, polymorphic_name, polymorphic_type_map, #render, #resolve_urn_generator, #root, #to_hash, #to_mr_string, #to_s, #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



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

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

#numberObject

Delegate common methods to adopted identifier



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

def number
  adopted_identifier&.number
end

#partObject



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

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

#partsObject



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

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

#yearObject



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

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