Class: Pubid::Csa::Identifiers::Cec
- Inherits:
-
SingleIdentifier
- Object
- Lutaml::Model::Serializable
- Identifier
- SingleIdentifier
- Pubid::Csa::Identifiers::Cec
- Defined in:
- lib/pubid/csa/identifiers/cec.rb
Overview
Canadian Electrical Code (CEC) identifier Pattern: CSA C22.2,3,4,6 NO. number:Identifier#year Examples: CSA C22.2 NO. 286:23, CSA C22.3 NO. 7:20
The “NO.” indicates a numbered standard within the C22.x series and must be preserved (not normalized) as a semantic component.
Instance Method Summary collapse
-
#code ⇒ Object
Combined code attribute for compatibility Returns cec_part + “-” + no_number (e.g., “C22.2-1”).
- #to_s(**opts) ⇒ Object
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, #year
Constructor Details
This class inherits a constructor from Pubid::Identifier
Instance Method Details
#code ⇒ Object
Combined code attribute for compatibility Returns cec_part + “-” + no_number (e.g., “C22.2-1”)
18 19 20 21 22 |
# File 'lib/pubid/csa/identifiers/cec.rb', line 18 def code return nil unless cec_part && no_number @code ||= Components::Code.new(value: "#{cec_part.value}-#{no_number.value}") end |
#to_s(**opts) ⇒ Object
24 25 26 |
# File 'lib/pubid/csa/identifiers/cec.rb', line 24 def to_s(**opts) render(format: :human, **opts) end |