pubid 2.0.0.pre.alpha.8 → 2.0.0.pre.alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.adoc +33 -11
- data/conformance/pending.yaml +4 -0
- data/data/bipm/update_codes.yaml +9 -0
- data/data/iec/update_codes.yaml +3 -0
- data/data/ieee/update_codes.yaml +107 -1
- data/{archived-gems/pubid-nist → data/nist}/series.yaml +34 -0
- data/data/nist/update_codes.yaml +8 -0
- data/lib/pubid/adobe/builder.rb +52 -0
- data/lib/pubid/adobe/identifier.rb +47 -0
- data/lib/pubid/adobe/identifiers/publication.rb +31 -0
- data/lib/pubid/adobe/identifiers/tech_note.rb +32 -0
- data/lib/pubid/adobe/identifiers.rb +10 -0
- data/lib/pubid/adobe/parser.rb +136 -0
- data/lib/pubid/adobe/renderer.rb +39 -0
- data/lib/pubid/adobe/urn_generator.rb +42 -0
- data/lib/pubid/adobe/urn_parser.rb +69 -0
- data/lib/pubid/adobe.rb +61 -0
- data/lib/pubid/amca/builder.rb +4 -4
- data/lib/pubid/amca/identifier.rb +1 -3
- data/lib/pubid/amca/identifiers/base.rb +50 -33
- data/lib/pubid/amca/identifiers/interpretation.rb +18 -10
- data/lib/pubid/amca/identifiers/publication.rb +14 -10
- data/lib/pubid/amca/identifiers/standard.rb +3 -1
- data/lib/pubid/amca/identifiers.rb +0 -1
- data/lib/pubid/amca/parser.rb +1 -1
- data/lib/pubid/amca/renderer.rb +4 -4
- data/lib/pubid/amca/single_identifier.rb +1 -1
- data/lib/pubid/amca/urn_generator.rb +2 -2
- data/lib/pubid/amca.rb +5 -4
- data/lib/pubid/ansi/builder.rb +2 -2
- data/lib/pubid/ansi/identifier.rb +18 -0
- data/lib/pubid/ansi/parser.rb +1 -1
- data/lib/pubid/ansi/renderer.rb +2 -2
- data/lib/pubid/ansi.rb +5 -5
- data/lib/pubid/api/builder.rb +16 -2
- data/lib/pubid/api/identifier.rb +25 -4
- data/lib/pubid/api/identifiers/mpms.rb +10 -8
- data/lib/pubid/api/parser.rb +1 -1
- data/lib/pubid/api/renderer.rb +16 -7
- data/lib/pubid/api/single_identifier.rb +5 -12
- data/lib/pubid/api.rb +1 -0
- data/lib/pubid/ashrae/builder.rb +53 -32
- data/lib/pubid/ashrae/identifier.rb +3 -4
- data/lib/pubid/ashrae/identifiers/addenda_package.rb +7 -1
- data/lib/pubid/ashrae/identifiers/addendum.rb +9 -1
- data/lib/pubid/ashrae/identifiers/base.rb +94 -12
- data/lib/pubid/ashrae/identifiers/combined_addenda.rb +8 -1
- data/lib/pubid/ashrae/identifiers/errata.rb +9 -0
- data/lib/pubid/ashrae/identifiers/guideline.rb +3 -0
- data/lib/pubid/ashrae/identifiers/interpretation.rb +16 -0
- data/lib/pubid/ashrae/identifiers/standard.rb +3 -0
- data/lib/pubid/ashrae/identifiers.rb +0 -1
- data/lib/pubid/ashrae/parser.rb +37 -17
- data/lib/pubid/ashrae/renderer.rb +20 -20
- data/lib/pubid/ashrae/single_identifier.rb +1 -1
- data/lib/pubid/ashrae/supplement_identifier.rb +21 -6
- data/lib/pubid/ashrae/urn_generator.rb +8 -2
- data/lib/pubid/ashrae.rb +10 -4
- data/lib/pubid/asme/builder.rb +11 -2
- data/lib/pubid/asme/identifier.rb +9 -0
- data/lib/pubid/asme/identifiers/standard.rb +86 -2
- data/lib/pubid/asme/parser.rb +1 -1
- data/lib/pubid/asme/renderer.rb +3 -3
- data/lib/pubid/asme/single_identifier.rb +8 -1
- data/lib/pubid/asme/urn_generator.rb +2 -2
- data/lib/pubid/asme.rb +1 -0
- data/lib/pubid/astm/builder.rb +10 -3
- data/lib/pubid/astm/identifier.rb +9 -0
- data/lib/pubid/astm/identifiers/adjunct.rb +16 -1
- data/lib/pubid/astm/identifiers/code_number.rb +81 -0
- data/lib/pubid/astm/identifiers/data_series.rb +2 -0
- data/lib/pubid/astm/identifiers/iso_dual_published.rb +16 -0
- data/lib/pubid/astm/identifiers/manual.rb +10 -0
- data/lib/pubid/astm/identifiers/monograph.rb +2 -0
- data/lib/pubid/astm/identifiers/research_report.rb +10 -0
- data/lib/pubid/astm/identifiers/standard.rb +10 -0
- data/lib/pubid/astm/identifiers/technical_report.rb +2 -0
- data/lib/pubid/astm/identifiers/work_in_progress.rb +2 -0
- data/lib/pubid/astm/identifiers.rb +1 -0
- data/lib/pubid/astm/parser.rb +1 -1
- data/lib/pubid/astm/renderer.rb +1 -1
- data/lib/pubid/astm/single_identifier.rb +31 -1
- data/lib/pubid/astm/urn_generator.rb +7 -5
- data/lib/pubid/astm.rb +1 -0
- data/lib/pubid/bipm/builder.rb +163 -0
- data/lib/pubid/bipm/identifier.rb +285 -0
- data/lib/pubid/bipm/identifiers/committee_document.rb +36 -0
- data/lib/pubid/bipm/identifiers/guide.rb +35 -0
- data/lib/pubid/bipm/identifiers/meeting.rb +53 -0
- data/lib/pubid/bipm/identifiers/mep.rb +33 -0
- data/lib/pubid/bipm/identifiers/metrologia_article.rb +48 -0
- data/lib/pubid/bipm/identifiers/si_brochure.rb +33 -0
- data/lib/pubid/bipm/identifiers.rb +15 -0
- data/lib/pubid/bipm/parser.rb +237 -0
- data/lib/pubid/bipm/renderer.rb +118 -0
- data/lib/pubid/bipm/urn_generator.rb +58 -0
- data/lib/pubid/bipm/urn_parser.rb +60 -0
- data/lib/pubid/bipm.rb +92 -0
- data/lib/pubid/bsi/builder.rb +62 -52
- data/lib/pubid/bsi/identifier.rb +0 -1
- data/lib/pubid/bsi/identifiers/addendum_document.rb +2 -2
- data/lib/pubid/bsi/identifiers/adopted_european_norm.rb +36 -7
- data/lib/pubid/bsi/identifiers/adopted_international_standard.rb +7 -6
- data/lib/pubid/bsi/identifiers/amendment.rb +4 -4
- data/lib/pubid/bsi/identifiers/british_industrial_practice.rb +0 -1
- data/lib/pubid/bsi/identifiers/bundled_identifier.rb +10 -0
- data/lib/pubid/bsi/identifiers/committee_document.rb +10 -1
- data/lib/pubid/bsi/identifiers/consolidated_identifier.rb +6 -0
- data/lib/pubid/bsi/identifiers/corrigendum.rb +4 -4
- data/lib/pubid/bsi/identifiers/expert_commentary.rb +5 -5
- data/lib/pubid/bsi/identifiers/handbook.rb +0 -2
- data/lib/pubid/bsi/identifiers/practice_guide.rb +0 -1
- data/lib/pubid/bsi/identifiers/set.rb +11 -0
- data/lib/pubid/bsi/identifiers/standalone_amendment.rb +10 -1
- data/lib/pubid/bsi/identifiers/supplement_document.rb +2 -2
- data/lib/pubid/bsi/identifiers/value_added_publication.rb +6 -6
- data/lib/pubid/bsi/parser.rb +1 -1
- data/lib/pubid/bsi/renderer.rb +71 -59
- data/lib/pubid/bsi/single_identifier.rb +64 -7
- data/lib/pubid/bsi/urn_generator.rb +11 -2
- data/lib/pubid/bsi.rb +7 -1
- data/lib/pubid/builder/base.rb +23 -11
- data/lib/pubid/bundled_identifier.rb +19 -9
- data/lib/pubid/calconnect/builder.rb +38 -0
- data/lib/pubid/calconnect/identifier.rb +121 -0
- data/lib/pubid/calconnect/identifiers/standard.rb +29 -0
- data/lib/pubid/calconnect/identifiers.rb +9 -0
- data/lib/pubid/calconnect/parser.rb +54 -0
- data/lib/pubid/calconnect/renderer.rb +36 -0
- data/lib/pubid/calconnect/urn_generator.rb +33 -0
- data/lib/pubid/calconnect/urn_parser.rb +34 -0
- data/lib/pubid/calconnect.rb +83 -0
- data/lib/pubid/ccsds/builder.rb +1 -1
- data/lib/pubid/ccsds/identifier.rb +10 -3
- data/lib/pubid/ccsds/identifiers/base.rb +4 -2
- data/lib/pubid/ccsds/identifiers/corrigendum.rb +4 -4
- data/lib/pubid/ccsds/parser.rb +1 -1
- data/lib/pubid/ccsds/single_identifier.rb +2 -2
- data/lib/pubid/ccsds/supplement_identifier.rb +6 -6
- data/lib/pubid/ccsds/urn_generator.rb +3 -3
- data/lib/pubid/ccsds.rb +1 -0
- data/lib/pubid/cen_cenelec/builder.rb +131 -72
- data/lib/pubid/cen_cenelec/identifier.rb +115 -3
- data/lib/pubid/cen_cenelec/identifiers/adopted_european_norm.rb +27 -16
- data/lib/pubid/cen_cenelec/identifiers/amendment.rb +46 -6
- data/lib/pubid/cen_cenelec/identifiers/base.rb +8 -9
- data/lib/pubid/cen_cenelec/identifiers/cen_report.rb +1 -1
- data/lib/pubid/cen_cenelec/identifiers/cen_workshop_agreement.rb +1 -1
- data/lib/pubid/cen_cenelec/identifiers/cenelec_harmonization_document.rb +1 -1
- data/lib/pubid/cen_cenelec/identifiers/consolidated_identifier.rb +29 -14
- data/lib/pubid/cen_cenelec/identifiers/corrigendum.rb +47 -8
- data/lib/pubid/cen_cenelec/identifiers/european_norm.rb +60 -3
- data/lib/pubid/cen_cenelec/identifiers/european_prestandard.rb +27 -2
- data/lib/pubid/cen_cenelec/identifiers/european_specification.rb +1 -1
- data/lib/pubid/cen_cenelec/identifiers/fragment.rb +15 -5
- data/lib/pubid/cen_cenelec/identifiers/guide.rb +1 -1
- data/lib/pubid/cen_cenelec/identifiers/harmonization_document.rb +1 -1
- data/lib/pubid/cen_cenelec/identifiers/technical_report.rb +1 -1
- data/lib/pubid/cen_cenelec/identifiers/technical_specification.rb +1 -1
- data/lib/pubid/cen_cenelec/parser.rb +1 -1
- data/lib/pubid/cen_cenelec/renderer.rb +55 -60
- data/lib/pubid/cen_cenelec/single_identifier.rb +20 -2
- data/lib/pubid/cen_cenelec/urn_generator.rb +66 -44
- data/lib/pubid/cen_cenelec.rb +104 -82
- data/lib/pubid/cie/builder.rb +149 -24
- data/lib/pubid/cie/identifier.rb +13 -4
- data/lib/pubid/cie/identifiers/bundle.rb +35 -5
- data/lib/pubid/cie/identifiers/code_attributes.rb +52 -0
- data/lib/pubid/cie/identifiers/conference.rb +11 -6
- data/lib/pubid/cie/identifiers/corrigendum.rb +17 -23
- data/lib/pubid/cie/identifiers/dual_published.rb +6 -6
- data/lib/pubid/cie/identifiers/identical.rb +9 -9
- data/lib/pubid/cie/identifiers/joint_published.rb +10 -10
- data/lib/pubid/cie/identifiers/proceedings.rb +41 -0
- data/lib/pubid/cie/identifiers/standard.rb +43 -8
- data/lib/pubid/cie/identifiers/supplement.rb +27 -25
- data/lib/pubid/cie/identifiers/tutorial_bundle.rb +7 -3
- data/lib/pubid/cie/identifiers.rb +2 -0
- data/lib/pubid/cie/parser.rb +55 -6
- data/lib/pubid/cie/single_identifier.rb +40 -1
- data/lib/pubid/cie/supplement_identifier.rb +29 -16
- data/lib/pubid/cie/urn_generator.rb +11 -8
- data/lib/pubid/cie.rb +7 -2
- data/lib/pubid/components/date.rb +21 -5
- data/lib/pubid/conformance/checks.rb +72 -0
- data/lib/pubid/conformance/corpus/case.rb +55 -0
- data/lib/pubid/conformance/corpus.rb +36 -0
- data/lib/pubid/conformance/generator.rb +212 -0
- data/lib/pubid/conformance/pending.rb +63 -0
- data/lib/pubid/conformance/runner.rb +153 -0
- data/lib/pubid/conformance.rb +55 -0
- data/lib/pubid/core.rb +2 -0
- data/lib/pubid/csa/builder.rb +48 -48
- data/lib/pubid/csa/composite_identifier.rb +18 -7
- data/lib/pubid/csa/identifier.rb +187 -80
- data/lib/pubid/csa/identifiers/bundled.rb +25 -9
- data/lib/pubid/csa/identifiers/canadian_adopted.rb +13 -13
- data/lib/pubid/csa/identifiers/cec.rb +44 -4
- data/lib/pubid/csa/identifiers/combined.rb +97 -69
- data/lib/pubid/csa/identifiers/csa_adopted.rb +4 -4
- data/lib/pubid/csa/identifiers/package.rb +4 -4
- data/lib/pubid/csa/parser.rb +12 -8
- data/lib/pubid/csa/renderer.rb +13 -5
- data/lib/pubid/csa/single_identifier.rb +93 -4
- data/lib/pubid/csa/urn_generator.rb +9 -2
- data/lib/pubid/csa/wrapper_identifier.rb +43 -10
- data/lib/pubid/csa.rb +7 -1
- data/lib/pubid/doi/builder.rb +18 -0
- data/lib/pubid/doi/identifier.rb +49 -0
- data/lib/pubid/doi/identifiers/resource.rb +30 -0
- data/lib/pubid/doi/identifiers.rb +9 -0
- data/lib/pubid/doi/parser.rb +52 -0
- data/lib/pubid/doi/renderer.rb +13 -0
- data/lib/pubid/doi.rb +56 -0
- data/lib/pubid/easc/builder.rb +55 -0
- data/lib/pubid/easc/identifier.rb +59 -0
- data/lib/pubid/easc/identifiers/pmg.rb +20 -0
- data/lib/pubid/easc/identifiers/rmg.rb +19 -0
- data/lib/pubid/easc/identifiers.rb +10 -0
- data/lib/pubid/easc/parser.rb +88 -0
- data/lib/pubid/easc/renderer.rb +48 -0
- data/lib/pubid/easc/urn_generator.rb +46 -0
- data/lib/pubid/easc/urn_parser.rb +57 -0
- data/lib/pubid/easc.rb +53 -0
- data/lib/pubid/ecma/builder.rb +45 -0
- data/lib/pubid/ecma/identifier.rb +147 -0
- data/lib/pubid/ecma/identifiers/memento.rb +30 -0
- data/lib/pubid/ecma/identifiers/standard.rb +31 -0
- data/lib/pubid/ecma/identifiers/technical_report.rb +31 -0
- data/lib/pubid/ecma/identifiers.rb +11 -0
- data/lib/pubid/ecma/parser.rb +76 -0
- data/lib/pubid/ecma/renderer.rb +67 -0
- data/lib/pubid/ecma/urn_generator.rb +46 -0
- data/lib/pubid/ecma/urn_parser.rb +51 -0
- data/lib/pubid/ecma.rb +68 -0
- data/lib/pubid/errors.rb +80 -0
- data/lib/pubid/etsi/builder.rb +13 -4
- data/lib/pubid/etsi/identifier.rb +1 -3
- data/lib/pubid/etsi/identifiers/base.rb +43 -11
- data/lib/pubid/etsi/identifiers/etsi_standard.rb +207 -4
- data/lib/pubid/etsi/identifiers/supplement_identifier.rb +45 -3
- data/lib/pubid/etsi/identifiers.rb +0 -1
- data/lib/pubid/etsi/parser.rb +9 -3
- data/lib/pubid/etsi/renderer.rb +8 -2
- data/lib/pubid/etsi.rb +6 -5
- data/lib/pubid/evs/builder.rb +26 -0
- data/lib/pubid/evs/identifier.rb +37 -0
- data/lib/pubid/evs/identifiers/national_adoption.rb +17 -0
- data/lib/pubid/evs/identifiers.rb +9 -0
- data/lib/pubid/evs/parser.rb +27 -0
- data/lib/pubid/evs/renderer.rb +30 -0
- data/lib/pubid/evs/urn_generator.rb +30 -0
- data/lib/pubid/evs/urn_parser.rb +80 -0
- data/lib/pubid/evs.rb +90 -0
- data/lib/pubid/export/exporter.rb +2 -1
- data/lib/pubid/export/flavor_exporter.rb +18 -3
- data/lib/pubid/export.rb +1 -0
- data/lib/pubid/format_detector.rb +1 -0
- data/lib/pubid/gb/builder.rb +45 -0
- data/lib/pubid/gb/identifier.rb +67 -0
- data/lib/pubid/gb/identifiers/standard.rb +34 -0
- data/lib/pubid/gb/identifiers.rb +9 -0
- data/lib/pubid/gb/parser.rb +63 -0
- data/lib/pubid/gb/renderer.rb +35 -0
- data/lib/pubid/gb.rb +88 -0
- data/lib/pubid/gost/builder.rb +185 -0
- data/lib/pubid/gost/identifier.rb +47 -0
- data/lib/pubid/gost/identifiers/foreign_reference.rb +25 -0
- data/lib/pubid/gost/identifiers/harmonized.rb +39 -0
- data/lib/pubid/gost/identifiers/identical_adoption.rb +39 -0
- data/lib/pubid/gost/identifiers/interstate_standard.rb +20 -0
- data/lib/pubid/gost/identifiers/national_standard.rb +19 -0
- data/lib/pubid/gost/identifiers.rb +13 -0
- data/lib/pubid/gost/parser.rb +105 -0
- data/lib/pubid/gost/renderer.rb +48 -0
- data/lib/pubid/gost/urn_generator.rb +46 -0
- data/lib/pubid/gost/urn_parser.rb +52 -0
- data/lib/pubid/gost.rb +50 -0
- data/lib/pubid/iala/builder.rb +22 -27
- data/lib/pubid/iala/identifier.rb +36 -8
- data/lib/pubid/iala/identifiers/advice.rb +1 -1
- data/lib/pubid/iala/identifiers/annex.rb +10 -10
- data/lib/pubid/iala/identifiers/general_assembly.rb +5 -2
- data/lib/pubid/iala/identifiers/guideline.rb +3 -1
- data/lib/pubid/iala/identifiers/letter.rb +1 -1
- data/lib/pubid/iala/identifiers/manual.rb +3 -1
- data/lib/pubid/iala/identifiers/model_course.rb +3 -1
- data/lib/pubid/iala/identifiers/recommendation.rb +3 -1
- data/lib/pubid/iala/identifiers/report.rb +1 -1
- data/lib/pubid/iala/identifiers/resolution.rb +1 -1
- data/lib/pubid/iala/identifiers/standard.rb +3 -1
- data/lib/pubid/iala/identifiers.rb +0 -1
- data/lib/pubid/iala/parser.rb +10 -2
- data/lib/pubid/iala/renderer.rb +1 -1
- data/lib/pubid/iala/urn_generator.rb +1 -1
- data/lib/pubid/iala/urn_parser.rb +24 -3
- data/lib/pubid/iala.rb +5 -4
- data/lib/pubid/iana/builder.rb +22 -0
- data/lib/pubid/iana/identifier.rb +140 -0
- data/lib/pubid/iana/identifiers/registry.rb +69 -0
- data/lib/pubid/iana/identifiers.rb +9 -0
- data/lib/pubid/iana/parser.rb +38 -0
- data/lib/pubid/iana/renderer.rb +32 -0
- data/lib/pubid/iana/urn_generator.rb +19 -0
- data/lib/pubid/iana/urn_parser.rb +24 -0
- data/lib/pubid/iana.rb +70 -0
- data/lib/pubid/identifier.rb +797 -26
- data/lib/pubid/identifier_metadata.rb +1 -0
- data/lib/pubid/idf/builder.rb +4 -4
- data/lib/pubid/idf/identifier.rb +18 -9
- data/lib/pubid/idf/parser.rb +3 -3
- data/lib/pubid/idf/renderer.rb +5 -5
- data/lib/pubid/idf/supplement_identifier.rb +3 -3
- data/lib/pubid/idf/urn_generator.rb +1 -1
- data/lib/pubid/idf.rb +7 -1
- data/lib/pubid/iec/builder.rb +49 -32
- data/lib/pubid/iec/components.rb +0 -1
- data/lib/pubid/iec/identifier.rb +112 -77
- data/lib/pubid/iec/identifiers/amendment.rb +6 -2
- data/lib/pubid/iec/identifiers/base.rb +2 -2
- data/lib/pubid/iec/identifiers/component_specification.rb +0 -10
- data/lib/pubid/iec/identifiers/conformity_assessment.rb +0 -10
- data/lib/pubid/iec/identifiers/consolidated_identifier.rb +6 -0
- data/lib/pubid/iec/identifiers/corrigendum.rb +2 -2
- data/lib/pubid/iec/identifiers/fragment_identifier.rb +13 -15
- data/lib/pubid/iec/identifiers/guide.rb +0 -16
- data/lib/pubid/iec/identifiers/international_standard.rb +22 -6
- data/lib/pubid/iec/identifiers/operational_document.rb +0 -10
- data/lib/pubid/iec/identifiers/publicly_available_specification.rb +0 -12
- data/lib/pubid/iec/identifiers/sheet_identifier.rb +12 -12
- data/lib/pubid/iec/identifiers/societal_technology_trend_report.rb +0 -10
- data/lib/pubid/iec/identifiers/systems_reference_document.rb +0 -10
- data/lib/pubid/iec/identifiers/technical_group.rb +30 -0
- data/lib/pubid/iec/identifiers/technical_report.rb +1 -18
- data/lib/pubid/iec/identifiers/technical_specification.rb +1 -18
- data/lib/pubid/iec/identifiers/technology_report.rb +0 -10
- data/lib/pubid/iec/identifiers/test_report_form.rb +0 -11
- data/lib/pubid/iec/identifiers/vap_identifier.rb +12 -12
- data/lib/pubid/iec/identifiers/white_paper.rb +0 -10
- data/lib/pubid/iec/identifiers/working_document.rb +24 -10
- data/lib/pubid/iec/identifiers.rb +1 -0
- data/lib/pubid/iec/parser.rb +53 -28
- data/lib/pubid/iec/renderer.rb +31 -18
- data/lib/pubid/iec/single_identifier.rb +34 -11
- data/lib/pubid/iec/supplement_identifier.rb +32 -19
- data/lib/pubid/iec/urn_generator.rb +227 -61
- data/lib/pubid/iec/urn_parser.rb +42 -4
- data/lib/pubid/iec.rb +2 -6
- data/lib/pubid/ieee/aiee/builder.rb +17 -3
- data/lib/pubid/ieee/aiee/identifier.rb +46 -62
- data/lib/pubid/ieee/aiee/parser.rb +1 -1
- data/lib/pubid/ieee/builder.rb +386 -69
- data/lib/pubid/ieee/compaction.rb +121 -0
- data/lib/pubid/ieee/components/draft.rb +47 -7
- data/lib/pubid/ieee/identifier.rb +1 -3
- data/lib/pubid/ieee/identifiers/adopted_standard.rb +62 -5
- data/lib/pubid/ieee/identifiers/amendment.rb +40 -0
- data/lib/pubid/ieee/identifiers/base.rb +148 -18
- data/lib/pubid/ieee/identifiers/code_number.rb +82 -0
- data/lib/pubid/ieee/identifiers/conformance_identifier.rb +6 -2
- data/lib/pubid/ieee/identifiers/corrigendum.rb +17 -2
- data/lib/pubid/ieee/identifiers/csa_dual_published.rb +24 -3
- data/lib/pubid/ieee/identifiers/dual_identifier.rb +3 -3
- data/lib/pubid/ieee/identifiers/dual_published.rb +58 -3
- data/lib/pubid/ieee/identifiers/iec_ieee_copublished.rb +102 -5
- data/lib/pubid/ieee/identifiers/interpretation_identifier.rb +25 -1
- data/lib/pubid/ieee/identifiers/joint_development.rb +64 -15
- data/lib/pubid/ieee/identifiers/multi_numbered_identifier.rb +58 -6
- data/lib/pubid/ieee/identifiers/nesc/base.rb +90 -19
- data/lib/pubid/ieee/identifiers/nesc/draft.rb +20 -5
- data/lib/pubid/ieee/identifiers/nesc/edition.rb +32 -0
- data/lib/pubid/ieee/identifiers/nesc/handbook.rb +16 -5
- data/lib/pubid/ieee/identifiers/nesc/redline.rb +11 -2
- data/lib/pubid/ieee/identifiers/nesc/standard.rb +18 -3
- data/lib/pubid/ieee/identifiers/nesc.rb +1 -0
- data/lib/pubid/ieee/identifiers/parenthetical_identifier.rb +3 -3
- data/lib/pubid/ieee/identifiers/project_draft_identifier.rb +14 -6
- data/lib/pubid/ieee/identifiers/redlined_standard.rb +4 -4
- data/lib/pubid/ieee/identifiers/si_standard.rb +4 -1
- data/lib/pubid/ieee/identifiers/standard.rb +4 -1
- data/lib/pubid/ieee/identifiers/supplement_identifier.rb +26 -7
- data/lib/pubid/ieee/identifiers.rb +2 -1
- data/lib/pubid/ieee/ire/builder.rb +7 -6
- data/lib/pubid/ieee/ire/identifier.rb +48 -33
- data/lib/pubid/ieee/ire/parser.rb +1 -1
- data/lib/pubid/ieee/nesc/builder.rb +33 -20
- data/lib/pubid/ieee/nesc/parser.rb +16 -15
- data/lib/pubid/ieee/parser.rb +462 -44
- data/lib/pubid/ieee/pre_parser.rb +1 -1
- data/lib/pubid/ieee/renderer.rb +158 -57
- data/lib/pubid/ieee/typed_stages.rb +12 -1
- data/lib/pubid/ieee/urn_generator.rb +35 -8
- data/lib/pubid/ieee.rb +63 -4
- data/lib/pubid/ieee_debug.rb +1 -0
- data/lib/pubid/ietf/builder.rb +78 -0
- data/lib/pubid/ietf/identifier.rb +5 -0
- data/lib/pubid/ietf/identifiers/base.rb +72 -0
- data/lib/pubid/ietf/identifiers/bcp.rb +36 -0
- data/lib/pubid/ietf/identifiers/fyi.rb +36 -0
- data/lib/pubid/ietf/identifiers/internet_draft.rb +45 -0
- data/lib/pubid/ietf/identifiers/rfc.rb +27 -0
- data/lib/pubid/ietf/identifiers/serialization.rb +51 -0
- data/lib/pubid/ietf/identifiers/std.rb +36 -0
- data/lib/pubid/ietf/identifiers.rb +14 -0
- data/lib/pubid/ietf/parser.rb +61 -0
- data/lib/pubid/ietf/renderer.rb +64 -0
- data/lib/pubid/ietf/urn_generator.rb +37 -0
- data/lib/pubid/ietf/urn_parser.rb +43 -0
- data/lib/pubid/ietf.rb +86 -0
- data/lib/pubid/iho/identifier.rb +1 -3
- data/lib/pubid/iho/identifiers/base.rb +11 -10
- data/lib/pubid/iho/identifiers/bibliographic.rb +1 -1
- data/lib/pubid/iho/identifiers/circular_letter.rb +1 -1
- data/lib/pubid/iho/identifiers/miscellaneous.rb +1 -1
- data/lib/pubid/iho/identifiers/publication.rb +1 -1
- data/lib/pubid/iho/identifiers/standard.rb +1 -1
- data/lib/pubid/iho/identifiers.rb +0 -1
- data/lib/pubid/iho/parser.rb +1 -1
- data/lib/pubid/iho.rb +8 -7
- data/lib/pubid/isbn/builder.rb +44 -0
- data/lib/pubid/isbn/check_digit.rb +53 -0
- data/lib/pubid/isbn/identifier.rb +81 -0
- data/lib/pubid/isbn/identifiers/book.rb +30 -0
- data/lib/pubid/isbn/identifiers.rb +9 -0
- data/lib/pubid/isbn/parser.rb +45 -0
- data/lib/pubid/isbn/renderer.rb +16 -0
- data/lib/pubid/isbn.rb +53 -0
- data/lib/pubid/iso/builder.rb +9 -4
- data/lib/pubid/iso/bundled_identifier.rb +5 -3
- data/lib/pubid/iso/combined_identifier.rb +6 -4
- data/lib/pubid/iso/identifier.rb +29 -8
- data/lib/pubid/iso/identifiers/directives_supplement.rb +12 -12
- data/lib/pubid/iso/normalizer.rb +2 -2
- data/lib/pubid/iso/parser.rb +17 -13
- data/lib/pubid/iso/supplement_identifier.rb +19 -6
- data/lib/pubid/iso/urn_generator.rb +4 -1
- data/lib/pubid/iso/urn_parser.rb +1 -1
- data/lib/pubid/iso.rb +7 -1
- data/lib/pubid/itu/builder.rb +230 -29
- data/lib/pubid/itu/components/code.rb +48 -5
- data/lib/pubid/itu/components/designation.rb +35 -0
- data/lib/pubid/itu/components.rb +1 -0
- data/lib/pubid/itu/identifier.rb +1 -3
- data/lib/pubid/itu/identifiers/addendum.rb +15 -0
- data/lib/pubid/itu/identifiers/amendment.rb +7 -29
- data/lib/pubid/itu/identifiers/annex.rb +13 -2
- data/lib/pubid/itu/identifiers/annex_of_recommendation.rb +87 -0
- data/lib/pubid/itu/identifiers/appendix_of_recommendation.rb +92 -0
- data/lib/pubid/itu/identifiers/base.rb +357 -25
- data/lib/pubid/itu/identifiers/combined_identifier.rb +99 -23
- data/lib/pubid/itu/identifiers/corrigendum.rb +16 -23
- data/lib/pubid/itu/identifiers/errata.rb +15 -0
- data/lib/pubid/itu/identifiers/handbook.rb +38 -0
- data/lib/pubid/itu/identifiers/question.rb +63 -0
- data/lib/pubid/itu/identifiers/recommendation.rb +3 -2
- data/lib/pubid/itu/identifiers/report.rb +39 -0
- data/lib/pubid/itu/identifiers/special_publication.rb +3 -1
- data/lib/pubid/itu/identifiers/standard_serialization.rb +58 -0
- data/lib/pubid/itu/identifiers/supplement.rb +119 -14
- data/lib/pubid/itu/identifiers.rb +10 -1
- data/lib/pubid/itu/model.rb +1 -1
- data/lib/pubid/itu/parser.rb +481 -27
- data/lib/pubid/itu/urn_generator.rb +36 -6
- data/lib/pubid/itu/urn_parser.rb +8 -0
- data/lib/pubid/itu.rb +12 -3
- data/lib/pubid/jcgm/builder.rb +24 -14
- data/lib/pubid/jcgm/identifier.rb +10 -0
- data/lib/pubid/jcgm/identifiers/amendment.rb +0 -2
- data/lib/pubid/jcgm/identifiers/corrigendum.rb +34 -0
- data/lib/pubid/jcgm/identifiers/gum_guide.rb +3 -3
- data/lib/pubid/jcgm/identifiers/meeting.rb +47 -0
- data/lib/pubid/jcgm/identifiers.rb +2 -0
- data/lib/pubid/jcgm/parser.rb +74 -7
- data/lib/pubid/jcgm/renderer.rb +33 -12
- data/lib/pubid/jcgm/single_identifier.rb +84 -6
- data/lib/pubid/jcgm/supplement_identifier.rb +39 -4
- data/lib/pubid/jcgm/urn_generator.rb +21 -13
- data/lib/pubid/jcgm/urn_parser.rb +164 -10
- data/lib/pubid/jcgm.rb +10 -0
- data/lib/pubid/jis/identifier.rb +62 -3
- data/lib/pubid/jis/parser.rb +1 -1
- data/lib/pubid/jis.rb +1 -0
- data/lib/pubid/nist/builder.rb +29 -9
- data/lib/pubid/nist/caster.rb +7 -45
- data/lib/pubid/nist/circular_supplement_builder.rb +7 -5
- data/lib/pubid/nist/components/stage.rb +2 -2
- data/lib/pubid/nist/components/supplement.rb +5 -2
- data/lib/pubid/nist/configuration.rb +6 -2
- data/lib/pubid/nist/identifier.rb +1 -3
- data/lib/pubid/nist/identifiers/base.rb +133 -39
- data/lib/pubid/nist/identifiers/circular.rb +10 -3
- data/lib/pubid/nist/identifiers/circular_supplement.rb +14 -5
- data/lib/pubid/nist/identifiers/commercial_standard.rb +1 -1
- data/lib/pubid/nist/identifiers/commercial_standard_emergency.rb +1 -1
- data/lib/pubid/nist/identifiers/commercial_standards_monthly.rb +8 -2
- data/lib/pubid/nist/identifiers/crpl_report.rb +8 -2
- data/lib/pubid/nist/identifiers/dated_document.rb +1 -1
- data/lib/pubid/nist/identifiers/federal_information_processing_standards.rb +1 -1
- data/lib/pubid/nist/identifiers/grant_contractor_report.rb +1 -1
- data/lib/pubid/nist/identifiers/handbook.rb +10 -3
- data/lib/pubid/nist/identifiers/internal_report.rb +13 -6
- data/lib/pubid/nist/identifiers/letter_circular.rb +1 -1
- data/lib/pubid/nist/identifiers/miscellaneous_publication.rb +15 -7
- data/lib/pubid/nist/identifiers/monograph.rb +15 -8
- data/lib/pubid/nist/identifiers/ncstar.rb +2 -2
- data/lib/pubid/nist/identifiers/nsrds.rb +1 -1
- data/lib/pubid/nist/identifiers/owmwp.rb +1 -1
- data/lib/pubid/nist/identifiers/report.rb +15 -7
- data/lib/pubid/nist/identifiers/special_publication.rb +10 -1
- data/lib/pubid/nist/identifiers/technical_note.rb +1 -1
- data/lib/pubid/nist/identifiers.rb +0 -1
- data/lib/pubid/nist/parser.rb +27 -4
- data/lib/pubid/nist/preprocessor.rb +15 -0
- data/lib/pubid/nist/router.rb +2 -2
- data/lib/pubid/nist/series/ir.rb +0 -3
- data/lib/pubid/nist/supplement_identifier.rb +24 -9
- data/lib/pubid/nist.rb +19 -13
- data/lib/pubid/oasis/builder.rb +79 -0
- data/lib/pubid/oasis/identifier.rb +160 -0
- data/lib/pubid/oasis/identifiers/standard.rb +29 -0
- data/lib/pubid/oasis/identifiers.rb +9 -0
- data/lib/pubid/oasis/parser.rb +34 -0
- data/lib/pubid/oasis/renderer.rb +29 -0
- data/lib/pubid/oasis/urn_generator.rb +25 -0
- data/lib/pubid/oasis/urn_parser.rb +22 -0
- data/lib/pubid/oasis.rb +80 -0
- data/lib/pubid/ogc/builder.rb +33 -0
- data/lib/pubid/ogc/identifier.rb +81 -0
- data/lib/pubid/ogc/identifiers/document.rb +26 -0
- data/lib/pubid/ogc/identifiers.rb +10 -0
- data/lib/pubid/ogc/parser.rb +40 -0
- data/lib/pubid/ogc/renderer.rb +33 -0
- data/lib/pubid/ogc/urn_generator.rb +14 -0
- data/lib/pubid/ogc/urn_parser.rb +22 -0
- data/lib/pubid/ogc.rb +72 -0
- data/lib/pubid/oiml/builder.rb +36 -8
- data/lib/pubid/oiml/identifier.rb +9 -1
- data/lib/pubid/oiml/identifiers/basic_publication.rb +2 -0
- data/lib/pubid/oiml/identifiers/bulletin.rb +36 -0
- data/lib/pubid/oiml/identifiers/code_number.rb +90 -0
- data/lib/pubid/oiml/identifiers/document.rb +2 -0
- data/lib/pubid/oiml/identifiers/expert_report.rb +2 -0
- data/lib/pubid/oiml/identifiers/guide.rb +2 -0
- data/lib/pubid/oiml/identifiers/recommendation.rb +2 -0
- data/lib/pubid/oiml/identifiers/seminar_report.rb +2 -0
- data/lib/pubid/oiml/identifiers/vocabulary.rb +2 -0
- data/lib/pubid/oiml/identifiers.rb +1 -0
- data/lib/pubid/oiml/parser.rb +12 -13
- data/lib/pubid/oiml/renderer.rb +13 -13
- data/lib/pubid/oiml/single_identifier.rb +41 -37
- data/lib/pubid/oiml/supplement_identifier.rb +36 -9
- data/lib/pubid/oiml/urn_parser.rb +23 -6
- data/lib/pubid/oiml.rb +10 -0
- data/lib/pubid/omg/builder.rb +20 -0
- data/lib/pubid/omg/identifier.rb +61 -0
- data/lib/pubid/omg/identifiers/specification.rb +32 -0
- data/lib/pubid/omg/identifiers.rb +9 -0
- data/lib/pubid/omg/parser.rb +93 -0
- data/lib/pubid/omg/renderer.rb +31 -0
- data/lib/pubid/omg.rb +52 -0
- data/lib/pubid/parser/grammar.rb +74 -0
- data/lib/pubid/parser.rb +2 -0
- data/lib/pubid/parsers/mr_string.rb +120 -7
- data/lib/pubid/plateau/builder.rb +8 -4
- data/lib/pubid/plateau/identifier.rb +1 -3
- data/lib/pubid/plateau/identifiers/base.rb +1 -6
- data/lib/pubid/plateau/identifiers/handbook.rb +1 -1
- data/lib/pubid/plateau/identifiers/technical_report.rb +1 -1
- data/lib/pubid/plateau/identifiers.rb +0 -1
- data/lib/pubid/plateau/parser.rb +16 -6
- data/lib/pubid/plateau/renderer.rb +1 -1
- data/lib/pubid/plateau/supplement_identifier.rb +11 -11
- data/lib/pubid/plateau.rb +14 -4
- data/lib/pubid/prefixes_support.rb +1 -0
- data/lib/pubid/renderers/annotator.rb +233 -0
- data/lib/pubid/renderers/base.rb +13 -0
- data/lib/pubid/renderers/directives_renderer.rb +3 -3
- data/lib/pubid/renderers/human_readable.rb +6 -4
- data/lib/pubid/renderers/mr_string.rb +54 -6
- data/lib/pubid/renderers/supplement_renderer.rb +1 -1
- data/lib/pubid/renderers.rb +1 -0
- data/lib/pubid/rendering/numbering.rb +25 -7
- data/lib/pubid/rendering/supplement.rb +4 -4
- data/lib/pubid/rendering.rb +1 -0
- data/lib/pubid/sae/builder.rb +1 -1
- data/lib/pubid/sae/identifier.rb +1 -3
- data/lib/pubid/sae/identifiers/base.rb +19 -9
- data/lib/pubid/sae/identifiers.rb +0 -1
- data/lib/pubid/sae/parser.rb +1 -1
- data/lib/pubid/sae.rb +4 -3
- data/lib/pubid/schema/declaration.rb +33 -0
- data/lib/pubid/schema/error.rb +14 -0
- data/lib/pubid/schema/identifier_type.rb +23 -0
- data/lib/pubid/schema/loader.rb +117 -0
- data/lib/pubid/schema/typed_stage.rb +24 -0
- data/lib/pubid/schema.rb +25 -0
- data/lib/pubid/tgpp/builder.rb +41 -0
- data/lib/pubid/tgpp/identifier.rb +107 -0
- data/lib/pubid/tgpp/identifiers/technical_report.rb +32 -0
- data/lib/pubid/tgpp/identifiers/technical_specification.rb +33 -0
- data/lib/pubid/tgpp/identifiers.rb +11 -0
- data/lib/pubid/tgpp/parser.rb +78 -0
- data/lib/pubid/tgpp/renderer.rb +52 -0
- data/lib/pubid/tgpp/urn_generator.rb +39 -0
- data/lib/pubid/tgpp/urn_parser.rb +30 -0
- data/lib/pubid/tgpp.rb +84 -0
- data/lib/pubid/type_resolver.rb +74 -0
- data/lib/pubid/un/builder.rb +42 -0
- data/lib/pubid/un/identifier.rb +40 -0
- data/lib/pubid/un/identifiers/document.rb +24 -0
- data/lib/pubid/un/identifiers.rb +9 -0
- data/lib/pubid/un/parser.rb +25 -0
- data/lib/pubid/un/renderer.rb +11 -0
- data/lib/pubid/un.rb +47 -0
- data/lib/pubid/urn_parser/errors.rb +8 -1
- data/lib/pubid/urn_parser.rb +1 -0
- data/lib/pubid/utils.rb +1 -0
- data/lib/pubid/version.rb +1 -1
- data/lib/pubid/w3c/builder.rb +55 -0
- data/lib/pubid/w3c/identifier.rb +130 -0
- data/lib/pubid/w3c/identifiers/candidate_recommendation.rb +31 -0
- data/lib/pubid/w3c/identifiers/candidate_recommendation_draft.rb +31 -0
- data/lib/pubid/w3c/identifiers/draft_note.rb +31 -0
- data/lib/pubid/w3c/identifiers/note.rb +30 -0
- data/lib/pubid/w3c/identifiers/obsolete_recommendation.rb +31 -0
- data/lib/pubid/w3c/identifiers/proposed_edited_recommendation.rb +31 -0
- data/lib/pubid/w3c/identifiers/proposed_recommendation.rb +31 -0
- data/lib/pubid/w3c/identifiers/recommendation.rb +31 -0
- data/lib/pubid/w3c/identifiers/standard.rb +12 -0
- data/lib/pubid/w3c/identifiers/superseded_recommendation.rb +31 -0
- data/lib/pubid/w3c/identifiers/working_draft.rb +30 -0
- data/lib/pubid/w3c/identifiers.rb +25 -0
- data/lib/pubid/w3c/parser.rb +43 -0
- data/lib/pubid/w3c/renderer.rb +35 -0
- data/lib/pubid/w3c/urn_generator.rb +18 -0
- data/lib/pubid/w3c/urn_parser.rb +36 -0
- data/lib/pubid/w3c.rb +68 -0
- data/lib/pubid/xsf/builder.rb +17 -0
- data/lib/pubid/xsf/identifier.rb +66 -0
- data/lib/pubid/xsf/identifiers/xep.rb +31 -0
- data/lib/pubid/xsf/identifiers.rb +9 -0
- data/lib/pubid/xsf/parser.rb +38 -0
- data/lib/pubid/xsf/renderer.rb +23 -0
- data/lib/pubid/xsf/urn_generator.rb +13 -0
- data/lib/pubid/xsf/urn_parser.rb +18 -0
- data/lib/pubid/xsf.rb +82 -0
- data/lib/pubid.rb +424 -22
- data/lib/tasks/conformance.rake +34 -0
- data/lib/tasks/docs.rake +3 -3
- data/lib/tasks/schema.rake +88 -0
- data/schema/core/joint_prefixes.yaml +24 -0
- data/schema/iec.yaml +1017 -0
- data/schema/iso.yaml +1586 -0
- data/schema/schema.schema.yaml +96 -0
- metadata +241 -19
- data/archived-gems/pubid-ccsds/update_codes.yaml +0 -1
- data/archived-gems/pubid-iec/stages.yaml +0 -129
- data/archived-gems/pubid-iec/update_codes.yaml +0 -67
- data/archived-gems/pubid-ieee/update_codes.yaml +0 -104
- data/archived-gems/pubid-iso/stages.yaml +0 -106
- data/archived-gems/pubid-iso/update_codes.yaml +0 -4
- data/archived-gems/pubid-itu/i18n.yaml +0 -13
- data/archived-gems/pubid-itu/series.yaml +0 -42
- data/archived-gems/pubid-nist/publishers.yaml +0 -6
- data/archived-gems/pubid-nist/update_codes.yaml +0 -93
- data/archived-gems/pubid-plateau/update_codes.yaml +0 -6
- data/lib/pubid/cen_cenelec/supplement_identifier.rb +0 -48
- data/lib/pubid/cie/components/code.rb +0 -80
- data/lib/pubid/iala/identifiers/base.rb +0 -14
- data/lib/pubid/iec/components/code.rb +0 -36
- /data/{archived-gems/pubid-nist → data/nist}/stages.yaml +0 -0
|
@@ -13,21 +13,58 @@ module Pubid
|
|
|
13
13
|
#
|
|
14
14
|
# @example Standard format
|
|
15
15
|
# nesc = Pubid::Ieee.parse("C2-1997 National Electric Safety Code")
|
|
16
|
-
# nesc.code.
|
|
17
|
-
# nesc.year
|
|
16
|
+
# nesc.code.number # => "2" (prefix "C")
|
|
17
|
+
# nesc.year # => "1997"
|
|
18
18
|
#
|
|
19
19
|
# @example Handbook format
|
|
20
20
|
# nesc = Pubid::Ieee.parse("2017 NESC Handbook, Premier Edition")
|
|
21
|
-
# nesc.year
|
|
21
|
+
# nesc.year # => "2017"
|
|
22
22
|
# nesc.variant # => "Handbook"
|
|
23
23
|
# nesc.edition # => "Premier Edition"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
#
|
|
25
|
+
# Reparented onto Pubid::Ieee::Identifier (it used to descend from bare
|
|
26
|
+
# Lutaml::Model::Serializable) so NESC shares `#root`, a polymorphic
|
|
27
|
+
# `_type` and from_hash routing with every other IEEE type — see
|
|
28
|
+
# Pubid::Ieee::Aiee::Identifier for the same migration. Three
|
|
29
|
+
# attributes were reconciled against the base to avoid type collisions:
|
|
30
|
+
#
|
|
31
|
+
# `code` -> travels as the runtime `code_obj` (base #code returns
|
|
32
|
+
# it); the concrete leaves serialize the flat split
|
|
33
|
+
# columns via the CodeNumber mixin.
|
|
34
|
+
# `year` -> the base's plain `:string` year (was a
|
|
35
|
+
# Pubid::Components::Date), matching IEEE's scalar-date
|
|
36
|
+
# convention. `nesc.year` is now "2017", not a component.
|
|
37
|
+
# `draft` -> dropped; the base declares a `:string` `draft` (the draft
|
|
38
|
+
# *designator*), so a boolean here would corrupt it. Test
|
|
39
|
+
# draft-ness with `#draft?` / the Nesc::Draft class.
|
|
40
|
+
#
|
|
41
|
+
# This class is abstract and enforces it in #initialize: the builder
|
|
42
|
+
# always instantiates a concrete leaf (Nesc::Edition for the plain
|
|
43
|
+
# year-first form), because only leaves may redefine `number` as a
|
|
44
|
+
# :string (see the CodeNumber mixin) and only leaves declare the
|
|
45
|
+
# NESC-specific `polymorphic_name` that from_hash routes on.
|
|
46
|
+
class Base < Pubid::Ieee::Identifier
|
|
47
|
+
attribute :variant, :string # Handbook, Redline, etc.
|
|
48
|
+
# Registered-trademark "(R)" after the full name or abbreviation
|
|
49
|
+
attribute :registered, :boolean
|
|
50
|
+
# Whether the "(NESC)"/"(NESC(R))" abbreviation suffix was present
|
|
51
|
+
attribute :abbr_suffix, :boolean
|
|
52
|
+
# Registered-trademark "(R)" inside the "(NESC(R))" suffix
|
|
53
|
+
attribute :abbr_suffix_registered, :boolean
|
|
54
|
+
|
|
55
|
+
# Guards the abstract contract — see the class docs. Ruby has no
|
|
56
|
+
# `abstract`, and an instantiated Base would carry the derived
|
|
57
|
+
# `_type` "pubid:ieee:base" (which from_hash cannot resolve back to
|
|
58
|
+
# NESC) and a nil `number` (the empty relaton index key).
|
|
59
|
+
def initialize(args = {}, **kwargs)
|
|
60
|
+
if instance_of?(Base)
|
|
61
|
+
raise NotImplementedError,
|
|
62
|
+
"#{self.class} is abstract; instantiate a concrete NESC " \
|
|
63
|
+
"type (Standard, Edition, Handbook, Redline, Draft)"
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
super
|
|
67
|
+
end
|
|
31
68
|
|
|
32
69
|
# Publisher portion for NESC identifiers
|
|
33
70
|
#
|
|
@@ -36,18 +73,52 @@ module Pubid
|
|
|
36
73
|
"NESC"
|
|
37
74
|
end
|
|
38
75
|
|
|
39
|
-
#
|
|
76
|
+
# Whether this is a draft of the code. NESC has no `draft` attribute
|
|
77
|
+
# of its own (the base's `draft` is the draft designator string), so
|
|
78
|
+
# draft-ness lives in the class.
|
|
79
|
+
#
|
|
80
|
+
# @return [Boolean]
|
|
81
|
+
def draft?
|
|
82
|
+
is_a?(Nesc::Draft)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Rendering for year-first NESC identifiers (the C2-code standard form
|
|
86
|
+
# overrides this in Nesc::Standard). IEEE catalogues the year-first
|
|
87
|
+
# editions with the "IEEE Std" prefix, so it is prepended here.
|
|
40
88
|
#
|
|
89
|
+
# @param trademark [Boolean] append the IEEE trademark symbol (™/®)
|
|
41
90
|
# @return [String] String representation
|
|
42
|
-
def to_s
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
91
|
+
def to_s(trademark: false, **opts)
|
|
92
|
+
result = ["IEEE Std", year, name_portion].compact.join(" ")
|
|
93
|
+
result += trademark_symbol if trademark
|
|
94
|
+
annotate_plain_render(result, **opts)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Trademark symbol for this document's own code. A NESC string starts
|
|
98
|
+
# with the publication *year*, so the string-scanning
|
|
99
|
+
# Pubid::Ieee.trademark_symbol would pick the wrong field — an
|
|
100
|
+
# edition year of 2030 would silently render ®.
|
|
101
|
+
#
|
|
102
|
+
# @return [String] "®" or "™"
|
|
103
|
+
def trademark_symbol
|
|
104
|
+
Pubid::Ieee.trademark_symbol_for(code_obj&.number,
|
|
105
|
+
code_obj&.prefix,
|
|
106
|
+
publishers: [publisher])
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# The document-name portion, including the registered marks and the
|
|
110
|
+
# optional "(NESC(R))" abbreviation suffix.
|
|
111
|
+
#
|
|
112
|
+
# @return [String] e.g. "National Electrical Safety Code(R) (NESC(R))"
|
|
113
|
+
def name_portion
|
|
114
|
+
name = "National Electrical Safety Code"
|
|
115
|
+
name += "(R)" if registered
|
|
116
|
+
if abbr_suffix
|
|
117
|
+
suffix = "NESC"
|
|
118
|
+
suffix += "(R)" if abbr_suffix_registered
|
|
119
|
+
name += " (#{suffix})"
|
|
48
120
|
end
|
|
49
|
-
|
|
50
|
-
parts.join(" ")
|
|
121
|
+
name
|
|
51
122
|
end
|
|
52
123
|
end
|
|
53
124
|
end
|
|
@@ -10,16 +10,31 @@ module Pubid
|
|
|
10
10
|
# that are under development or review.
|
|
11
11
|
#
|
|
12
12
|
# @example
|
|
13
|
-
# nesc = Pubid::Ieee.parse("Draft
|
|
14
|
-
# nesc.to_s
|
|
13
|
+
# nesc = Pubid::Ieee.parse("Draft NESC, June 2011")
|
|
14
|
+
# nesc.to_s
|
|
15
|
+
# # => "Draft National Electrical Safety Code, June 2011"
|
|
16
|
+
#
|
|
17
|
+
# NOTE: the spelled-out "Draft National Electrical Safety Code, …" form
|
|
18
|
+
# is claimed by the generic IEEE grammar before it reaches the NESC
|
|
19
|
+
# sub-parser, so it does not currently build this class. Pre-existing
|
|
20
|
+
# dispatcher gap, pinned in spec/pubid/ieee/ire_nesc_roundtrip_spec.rb.
|
|
15
21
|
class Draft < Base
|
|
22
|
+
include Pubid::Ieee::Identifiers::CodeNumber
|
|
23
|
+
|
|
24
|
+
def self.polymorphic_name
|
|
25
|
+
"pubid:ieee:nesc-draft"
|
|
26
|
+
end
|
|
27
|
+
|
|
16
28
|
# Render draft identifier
|
|
17
29
|
#
|
|
30
|
+
# @param trademark [Boolean] append the IEEE trademark symbol (™/®)
|
|
18
31
|
# @return [String] Draft format with optional month and year
|
|
19
|
-
def to_s
|
|
32
|
+
def to_s(trademark: false, **opts)
|
|
20
33
|
parts = ["Draft National Electrical Safety Code"]
|
|
21
|
-
parts << ", #{month} #{year
|
|
22
|
-
parts.join
|
|
34
|
+
parts << ", #{month} #{year}" if month && year
|
|
35
|
+
result = parts.join
|
|
36
|
+
result += trademark_symbol if trademark
|
|
37
|
+
annotate_plain_render(result, **opts)
|
|
23
38
|
end
|
|
24
39
|
end
|
|
25
40
|
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module Ieee
|
|
5
|
+
module Identifiers
|
|
6
|
+
module Nesc
|
|
7
|
+
# A plain year-first NESC edition — the National Electrical Safety Code
|
|
8
|
+
# itself, referenced by publication year rather than by its C2 code.
|
|
9
|
+
#
|
|
10
|
+
# @example
|
|
11
|
+
# nesc = Pubid::Ieee.parse(
|
|
12
|
+
# "2017 National Electrical Safety Code(R) (NESC(R))",
|
|
13
|
+
# )
|
|
14
|
+
# nesc.to_s
|
|
15
|
+
# # => "IEEE Std 2017 National Electrical Safety Code(R) (NESC(R))"
|
|
16
|
+
#
|
|
17
|
+
# Rendering is Nesc::Base's; this class exists so that the builder never
|
|
18
|
+
# instantiates the abstract Base. Only concrete leaves may carry the
|
|
19
|
+
# CodeNumber mixin's `:string` `number` (see the mixin's notes on the
|
|
20
|
+
# multi-flavor attribute-resolution landmine), and every identifier that
|
|
21
|
+
# can be a `#root` needs a non-empty `number` for the relaton index.
|
|
22
|
+
class Edition < Base
|
|
23
|
+
include Pubid::Ieee::Identifiers::CodeNumber
|
|
24
|
+
|
|
25
|
+
def self.polymorphic_name
|
|
26
|
+
"pubid:ieee:nesc-edition"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -11,19 +11,30 @@ module Pubid
|
|
|
11
11
|
#
|
|
12
12
|
# @example Basic handbook
|
|
13
13
|
# nesc = Pubid::Ieee.parse("2012 NESC Handbook")
|
|
14
|
-
# nesc.to_s # => "2012 NESC Handbook"
|
|
14
|
+
# nesc.to_s # => "IEEE Std 2012 NESC Handbook"
|
|
15
15
|
#
|
|
16
16
|
# @example With edition
|
|
17
17
|
# nesc = Pubid::Ieee.parse("2017 NESC Handbook, Premier Edition")
|
|
18
|
-
# nesc.to_s # => "2017 NESC Handbook, Premier Edition"
|
|
18
|
+
# nesc.to_s # => "IEEE Std 2017 NESC Handbook, Premier Edition"
|
|
19
19
|
class Handbook < Base
|
|
20
|
+
include Pubid::Ieee::Identifiers::CodeNumber
|
|
21
|
+
|
|
22
|
+
def self.polymorphic_name
|
|
23
|
+
"pubid:ieee:nesc-handbook"
|
|
24
|
+
end
|
|
25
|
+
|
|
20
26
|
# Render handbook identifier
|
|
21
27
|
#
|
|
28
|
+
# @param trademark [Boolean] append the IEEE trademark symbol (™/®)
|
|
22
29
|
# @return [String] YYYY NESC Handbook format with optional edition
|
|
23
|
-
def to_s
|
|
24
|
-
|
|
30
|
+
def to_s(trademark: false, **opts)
|
|
31
|
+
abbr = "NESC"
|
|
32
|
+
abbr += "(R)" if registered
|
|
33
|
+
parts = [["IEEE Std", year, "#{abbr} Handbook"].compact.join(" ")]
|
|
25
34
|
parts << ", #{edition}" if edition
|
|
26
|
-
parts.join
|
|
35
|
+
result = parts.join
|
|
36
|
+
result += trademark_symbol if trademark
|
|
37
|
+
annotate_plain_render(result, **opts)
|
|
27
38
|
end
|
|
28
39
|
end
|
|
29
40
|
end
|
|
@@ -13,11 +13,20 @@ module Pubid
|
|
|
13
13
|
# nesc = Pubid::Ieee.parse("2017 NESC Redline")
|
|
14
14
|
# nesc.to_s # => "2017 NESC Redline"
|
|
15
15
|
class Redline < Base
|
|
16
|
+
include Pubid::Ieee::Identifiers::CodeNumber
|
|
17
|
+
|
|
18
|
+
def self.polymorphic_name
|
|
19
|
+
"pubid:ieee:nesc-redline"
|
|
20
|
+
end
|
|
21
|
+
|
|
16
22
|
# Render redline identifier
|
|
17
23
|
#
|
|
24
|
+
# @param trademark [Boolean] append the IEEE trademark symbol (™/®)
|
|
18
25
|
# @return [String] YYYY NESC Redline format
|
|
19
|
-
def to_s
|
|
20
|
-
|
|
26
|
+
def to_s(trademark: false, **opts)
|
|
27
|
+
result = [year, "NESC Redline"].compact.join(" ")
|
|
28
|
+
result += trademark_symbol if trademark
|
|
29
|
+
annotate_plain_render(result, **opts)
|
|
21
30
|
end
|
|
22
31
|
end
|
|
23
32
|
end
|
|
@@ -13,11 +13,26 @@ module Pubid
|
|
|
13
13
|
# nesc = Pubid::Ieee.parse("C2-1997 National Electric Safety Code")
|
|
14
14
|
# nesc.to_s # => "C2-1997 National Electrical Safety Code"
|
|
15
15
|
class Standard < Base
|
|
16
|
+
include Pubid::Ieee::Identifiers::CodeNumber
|
|
17
|
+
|
|
18
|
+
# Distinct from Identifiers::Standard, whose derived polymorphic name
|
|
19
|
+
# is also "pubid:ieee:standard".
|
|
20
|
+
def self.polymorphic_name
|
|
21
|
+
"pubid:ieee:nesc-standard"
|
|
22
|
+
end
|
|
23
|
+
|
|
16
24
|
# Render standard NESC identifier
|
|
17
25
|
#
|
|
18
|
-
# @
|
|
19
|
-
|
|
20
|
-
|
|
26
|
+
# @param trademark [Boolean] append the IEEE trademark symbol (™/®)
|
|
27
|
+
# @return [String] C2-YYYY format (bare "C2" when the year is absent,
|
|
28
|
+
# e.g. a partial reference produced by `#exclude(:year)`)
|
|
29
|
+
def to_s(trademark: false, **opts)
|
|
30
|
+
# Unlike the year-first NESC editions, this form renders a code, so
|
|
31
|
+
# the mark goes after it and before the year — as everywhere else.
|
|
32
|
+
code_part = "C2"
|
|
33
|
+
code_part += trademark_symbol if trademark
|
|
34
|
+
code_part += "-#{year}" if year
|
|
35
|
+
annotate_plain_render("#{code_part} National Electrical Safety Code", **opts)
|
|
21
36
|
end
|
|
22
37
|
end
|
|
23
38
|
end
|
|
@@ -6,6 +6,7 @@ module Pubid
|
|
|
6
6
|
module Nesc
|
|
7
7
|
autoload :Base, "#{__dir__}/nesc/base"
|
|
8
8
|
autoload :Draft, "#{__dir__}/nesc/draft"
|
|
9
|
+
autoload :Edition, "#{__dir__}/nesc/edition"
|
|
9
10
|
autoload :Handbook, "#{__dir__}/nesc/handbook"
|
|
10
11
|
autoload :Redline, "#{__dir__}/nesc/redline"
|
|
11
12
|
autoload :Standard, "#{__dir__}/nesc/standard"
|
|
@@ -5,9 +5,9 @@ module Pubid
|
|
|
5
5
|
module Identifiers
|
|
6
6
|
# Parenthetical Identifier - wraps identifier with parenthetical annotation
|
|
7
7
|
# Example: "IEEE Standard No 18-1968 (ANSI C55.1-1968)"
|
|
8
|
-
class ParentheticalIdentifier <
|
|
9
|
-
attribute :
|
|
10
|
-
attribute :parenthetical_identifier,
|
|
8
|
+
class ParentheticalIdentifier < Identifier
|
|
9
|
+
attribute :base, Identifier, polymorphic: true
|
|
10
|
+
attribute :parenthetical_identifier, Identifier, polymorphic: true
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
end
|
|
@@ -8,7 +8,12 @@ module Pubid
|
|
|
8
8
|
# where P1234 is the project number and D5 is the draft version
|
|
9
9
|
# This is distinct from a StandardIdentifier - the "P" indicates project status,
|
|
10
10
|
# not a code prefix like "C" in "C57.12"
|
|
11
|
-
class ProjectDraftIdentifier <
|
|
11
|
+
class ProjectDraftIdentifier < Identifier
|
|
12
|
+
# Reliable string `number` for relaton's index key (see CodeNumber).
|
|
13
|
+
# Its #initialize `super` chains through CodeNumber, which sets `number`
|
|
14
|
+
# from the (P-stripped) code after the parent builds code_obj.
|
|
15
|
+
include CodeNumber
|
|
16
|
+
|
|
12
17
|
TYPED_STAGES = [
|
|
13
18
|
Components::TypedStage.new(
|
|
14
19
|
abbr: ["P"],
|
|
@@ -24,16 +29,19 @@ module Pubid
|
|
|
24
29
|
{ key: :P, title: "Project Draft", short: "P" }
|
|
25
30
|
end
|
|
26
31
|
|
|
27
|
-
# Override initialize to strip "P" prefix from code before creating Code
|
|
28
|
-
# The "P" is reflected in the typed_stage, not in the Code
|
|
29
|
-
|
|
32
|
+
# Override initialize to strip "P" prefix from code before creating Code
|
|
33
|
+
# object. The "P" is reflected in the typed_stage, not in the Code
|
|
34
|
+
# component itself. Accepts keyword args or a single positional hash (the
|
|
35
|
+
# base #exclude/matching rebuild passes the latter).
|
|
36
|
+
def initialize(args = {}, **kwargs)
|
|
37
|
+
args = kwargs.empty? ? args.dup : args.merge(kwargs)
|
|
30
38
|
# If code is provided with "P" prefix (e.g., "P1234"), strip it
|
|
31
39
|
if args[:code].is_a?(String) && args[:code].start_with?("P")
|
|
32
40
|
args[:code] = args[:code][1..] # Strip leading "P"
|
|
33
41
|
end
|
|
34
42
|
|
|
35
|
-
# Call parent initialize with modified code
|
|
36
|
-
super
|
|
43
|
+
# Call parent initialize with modified code (positional hash)
|
|
44
|
+
super(args)
|
|
37
45
|
end
|
|
38
46
|
end
|
|
39
47
|
end
|
|
@@ -7,18 +7,18 @@ module Pubid
|
|
|
7
7
|
# IEEE standard with optional revision note, marked as redline
|
|
8
8
|
# Example: "IEEE Std 1018-2013 (Revison of IEEE Std 1018-2004) - Redline"
|
|
9
9
|
# Contains: base standard + optional revision standard + redline flag
|
|
10
|
-
class RedlinedStandard <
|
|
10
|
+
class RedlinedStandard < Identifier
|
|
11
11
|
# The current standard identifier
|
|
12
|
-
attribute :
|
|
12
|
+
attribute :base, Identifier, polymorphic: true
|
|
13
13
|
|
|
14
14
|
# Optional: the standard this revises
|
|
15
|
-
attribute :revision_of,
|
|
15
|
+
attribute :revision_of, Identifier, polymorphic: true
|
|
16
16
|
|
|
17
17
|
# Redline flag (always true for this class)
|
|
18
18
|
attribute :redline, :boolean, default: -> { true }
|
|
19
19
|
|
|
20
20
|
def publisher
|
|
21
|
-
|
|
21
|
+
base&.publisher || "IEEE"
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
end
|
|
@@ -8,7 +8,10 @@ module Pubid
|
|
|
8
8
|
# Handles both:
|
|
9
9
|
# - SI: Published standards (IEEE/ASTM SI 10-1997)
|
|
10
10
|
# - PSI: Proposed SI (drafts: IEEE/ASTM PSI 10/D2, October 2015)
|
|
11
|
-
class SiStandard <
|
|
11
|
+
class SiStandard < Identifier
|
|
12
|
+
# Reliable string `number` for relaton's index key (see CodeNumber).
|
|
13
|
+
include CodeNumber
|
|
14
|
+
|
|
12
15
|
# TYPED_STAGES for SI standards
|
|
13
16
|
TYPED_STAGES = [
|
|
14
17
|
Components::TypedStage.new(
|
|
@@ -17,7 +17,10 @@ module Pubid
|
|
|
17
17
|
# std = Pubid::Ieee.parse("ANSI/IEEE Std 500-1984")
|
|
18
18
|
# std.publisher # => "IEEE"
|
|
19
19
|
# std.copublisher # => ["ANSI"]
|
|
20
|
-
class Standard <
|
|
20
|
+
class Standard < Identifier
|
|
21
|
+
# Reliable string `number` for relaton's index key (see CodeNumber).
|
|
22
|
+
include CodeNumber
|
|
23
|
+
|
|
21
24
|
# TYPED_STAGES for published IEEE standards
|
|
22
25
|
# Standards use "Std" abbreviation for published state
|
|
23
26
|
TYPED_STAGES = [
|
|
@@ -3,19 +3,38 @@
|
|
|
3
3
|
module Pubid
|
|
4
4
|
module Ieee
|
|
5
5
|
module Identifiers
|
|
6
|
-
#
|
|
6
|
+
# Identifier class for supplement identifiers (amendments, corrigenda, interpretations, etc.)
|
|
7
7
|
# Supplements modify or add to a base document
|
|
8
|
-
class SupplementIdentifier <
|
|
9
|
-
attribute :
|
|
8
|
+
class SupplementIdentifier < Identifier
|
|
9
|
+
attribute :base, Identifier, polymorphic: true
|
|
10
10
|
|
|
11
|
-
# Delegate publisher to
|
|
11
|
+
# Delegate publisher to base
|
|
12
12
|
def publisher
|
|
13
|
-
|
|
13
|
+
base&.publisher
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
# Delegate code to
|
|
16
|
+
# Delegate code to base if not overridden
|
|
17
17
|
def code
|
|
18
|
-
|
|
18
|
+
base&.code
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# `publisher` is a pure delegation to `base`, so it must never be
|
|
22
|
+
# serialized independently on the wrapper. lutaml's default-tracking
|
|
23
|
+
# otherwise emits it asymmetrically — omitted on the parse path (the
|
|
24
|
+
# wrapper's own attribute is never assigned) but present after
|
|
25
|
+
# `from_hash` (deserialization assigns it) — which breaks the canonical
|
|
26
|
+
# `to_hash` round-trip for a supplement whose base carries a non-default
|
|
27
|
+
# publisher (e.g. an ANSI/ISO corrigendum). The truth lives in `base`.
|
|
28
|
+
def to_hash(*args)
|
|
29
|
+
hash = super
|
|
30
|
+
if hash.is_a?(::Hash)
|
|
31
|
+
# `publisher` and `code` are delegated to `base`; never serialize
|
|
32
|
+
# them on the wrapper (they'd duplicate base.publisher/base.number
|
|
33
|
+
# and, for publisher, desync across parse vs from_hash).
|
|
34
|
+
hash.delete("publisher")
|
|
35
|
+
hash.delete("code")
|
|
36
|
+
end
|
|
37
|
+
hash
|
|
19
38
|
end
|
|
20
39
|
end
|
|
21
40
|
end
|
|
@@ -4,9 +4,10 @@ module Pubid
|
|
|
4
4
|
module Ieee
|
|
5
5
|
module Identifiers
|
|
6
6
|
autoload :AdoptedStandard, "#{__dir__}/identifiers/adopted_standard"
|
|
7
|
-
autoload :
|
|
7
|
+
autoload :Amendment, "#{__dir__}/identifiers/amendment"
|
|
8
8
|
autoload :ConformanceIdentifier,
|
|
9
9
|
"#{__dir__}/identifiers/conformance_identifier"
|
|
10
|
+
autoload :CodeNumber, "#{__dir__}/identifiers/code_number"
|
|
10
11
|
autoload :Corrigendum, "#{__dir__}/identifiers/corrigendum"
|
|
11
12
|
autoload :CsaDualPublished, "#{__dir__}/identifiers/csa_dual_published"
|
|
12
13
|
autoload :DualIdentifier, "#{__dir__}/identifiers/dual_identifier"
|
|
@@ -14,11 +14,12 @@ module Pubid
|
|
|
14
14
|
# Extract type
|
|
15
15
|
attributes[:type] = extract_value(parsed[:type])
|
|
16
16
|
|
|
17
|
-
# Extract
|
|
17
|
+
# Extract the document designation. It travels as `code:` so the base
|
|
18
|
+
# initializer parses it into `code_obj` and the CodeNumber mixin
|
|
19
|
+
# hoists the flat split columns (number/prefix/parts/separator) that
|
|
20
|
+
# relaton indexes on.
|
|
18
21
|
number_str = extract_value(parsed[:number])
|
|
19
|
-
if number_str
|
|
20
|
-
attributes[:number] = Components::Code.parse(number_str)
|
|
21
|
-
end
|
|
22
|
+
attributes[:code] = number_str if number_str
|
|
22
23
|
|
|
23
24
|
# Extract year - handle both short (52) and full (1952) formats
|
|
24
25
|
year_str = extract_value(parsed[:year])
|
|
@@ -28,13 +29,13 @@ module Pubid
|
|
|
28
29
|
if year_int.between?(12, 63)
|
|
29
30
|
year_int += 1900
|
|
30
31
|
end
|
|
31
|
-
attributes[:year] = year_int
|
|
32
|
+
attributes[:year] = year_int.to_s
|
|
32
33
|
end
|
|
33
34
|
|
|
34
35
|
# Override with full_year if present
|
|
35
36
|
full_year_str = extract_value(parsed[:full_year])
|
|
36
37
|
if full_year_str
|
|
37
|
-
attributes[:year] = full_year_str.to_i
|
|
38
|
+
attributes[:year] = full_year_str.to_i.to_s
|
|
38
39
|
end
|
|
39
40
|
|
|
40
41
|
# Create identifier
|
|
@@ -5,32 +5,36 @@ require "lutaml/model"
|
|
|
5
5
|
module Pubid
|
|
6
6
|
module Ieee
|
|
7
7
|
module Ire
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
8
|
+
# IRE identifiers (Institute of Radio Engineers: 1912-1963).
|
|
9
|
+
#
|
|
10
|
+
# Reparented onto Pubid::Ieee::Identifier + the CodeNumber mixin for the
|
|
11
|
+
# same reasons AIEE was (see Pubid::Ieee::Aiee::Identifier): descending
|
|
12
|
+
# from bare Lutaml::Model::Serializable left IRE without `#root` (relaton
|
|
13
|
+
# keys its index on `id.root.number.to_s` -> NoMethodError), without a
|
|
14
|
+
# polymorphic `_type` (so `from_hash` could not route back), and — because
|
|
15
|
+
# an IRE object was not a ::Pubid::Identifier — unassignable to
|
|
16
|
+
# Identifiers::AdoptedStandard#adopted_identifiers, which raised
|
|
17
|
+
# Lutaml::Model::IncorrectModelError on `to_hash` for the IRE-adopted
|
|
18
|
+
# forms ("IEEE Std 159-1972 (52 IRE 7 S2)").
|
|
19
|
+
#
|
|
20
|
+
# The document designation ("7.S2") is carried in the shared `code_obj`
|
|
21
|
+
# and serialized as the flat split columns (number/prefix/parts/
|
|
22
|
+
# separator); the publication year uses the base's plain `:string` `year`
|
|
23
|
+
# (IRE previously declared its own `:integer` one, which would collide).
|
|
24
|
+
class Identifier < Pubid::Ieee::Identifier
|
|
25
|
+
include Pubid::Ieee::Identifiers::CodeNumber
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
attribute :publisher, :string, default: -> { "IRE" }
|
|
28
|
+
# IRE spells its type word out when present ("Trans.", "Standard",
|
|
29
|
+
# "Std") and omits it otherwise, so the base's "Std" default must go —
|
|
30
|
+
# else "52 IRE 7.S2" would render as "52 IRE Std 7.S2".
|
|
31
|
+
attribute :type, :string, default: -> {}
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
# A distinct polymorphic name so from_hash routes to IRE. The derived
|
|
34
|
+
# default (last name segment "Identifier") would be
|
|
35
|
+
# "pubid:ieee:identifier", colliding with the base class.
|
|
36
|
+
def self.polymorphic_name
|
|
37
|
+
"pubid:ieee:ire"
|
|
34
38
|
end
|
|
35
39
|
|
|
36
40
|
# Parse IRE identifier string
|
|
@@ -40,17 +44,28 @@ module Pubid
|
|
|
40
44
|
builder.build(parsed)
|
|
41
45
|
end
|
|
42
46
|
|
|
43
|
-
def to_s
|
|
44
|
-
parts = []
|
|
47
|
+
def to_s(trademark: false, **opts)
|
|
45
48
|
# Year comes FIRST in IRE format - render as 2-digit short year
|
|
46
|
-
if year
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
result = [(short_year if year), publisher, type, code&.to_s]
|
|
50
|
+
.compact.join(" ")
|
|
51
|
+
# The code is the last token, so the end of the string already *is*
|
|
52
|
+
# the code boundary — but the symbol is picked from the code, not by
|
|
53
|
+
# scanning the string (which starts with the year).
|
|
54
|
+
if trademark
|
|
55
|
+
result += Pubid::Ieee.trademark_symbol_for(code_obj&.number,
|
|
56
|
+
code_obj&.prefix,
|
|
57
|
+
publishers: [publisher])
|
|
49
58
|
end
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
59
|
+
annotate_plain_render(result, **opts)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
private
|
|
63
|
+
|
|
64
|
+
# IRE prints the publication year first, abbreviated to two digits for
|
|
65
|
+
# the 20th century ("1952" => "52").
|
|
66
|
+
def short_year
|
|
67
|
+
value = year.to_i
|
|
68
|
+
(value.between?(1900, 1999) ? value - 1900 : value).to_s
|
|
54
69
|
end
|
|
55
70
|
end
|
|
56
71
|
end
|
|
@@ -7,7 +7,7 @@ module Pubid
|
|
|
7
7
|
module Ire
|
|
8
8
|
# Parser for IRE (Institute of Radio Engineers) identifiers
|
|
9
9
|
# Historical period: 1912-1963 (merged into IEEE in 1963)
|
|
10
|
-
class Parser <
|
|
10
|
+
class Parser < ::Pubid::Parser::Grammar
|
|
11
11
|
# Basic building blocks
|
|
12
12
|
rule(:space) { str(" ") }
|
|
13
13
|
rule(:space?) { space.maybe }
|