Class: Pubid::CenCenelec::Scheme
- Defined in:
- lib/pubid/cen_cenelec/scheme.rb
Constant Summary collapse
- TYPED_STAGES_REGISTRY =
TYPED_STAGES_REGISTRY for native CEN types
[ # European Norm (EN) Pubid::Components::TypedStage.new( code: :puben, stage_code: :published, type_code: :en, abbr: ["EN"], name: "European Norm", harmonized_stages: %w[60.00 60.60], ), Pubid::Components::TypedStage.new( code: :pren, stage_code: :proposal, type_code: :en, abbr: ["prEN"], name: "Proposal European Norm", harmonized_stages: %w[30.00 30.20 30.60 30.92 30.98 30.99], ), Pubid::Components::TypedStage.new( code: :fpren, stage_code: :final_proposal, type_code: :en, abbr: ["FprEN"], name: "Final Proposal European Norm", harmonized_stages: %w[40.00 40.20 40.60 40.92 40.98 40.99], ), # Technical Specification (TS) Pubid::Components::TypedStage.new( code: :pubts, stage_code: :published, type_code: :ts, abbr: ["TS"], name: "Technical Specification", harmonized_stages: %w[60.00 60.60], ), Pubid::Components::TypedStage.new( code: :prts, stage_code: :proposal, type_code: :ts, abbr: ["prTS"], name: "Proposal Technical Specification", harmonized_stages: %w[30.00 30.20 30.60 30.92 30.98 30.99], ), # Technical Report (TR) Pubid::Components::TypedStage.new( code: :pubtr, stage_code: :published, type_code: :tr, abbr: ["TR"], name: "Technical Report", harmonized_stages: %w[60.00 60.60], ), # CEN Workshop Agreement (CWA) Pubid::Components::TypedStage.new( code: :pubcwa, stage_code: :published, type_code: :cwa, abbr: ["CWA"], name: "CEN Workshop Agreement", harmonized_stages: %w[60.00 60.60], ), # Guide Pubid::Components::TypedStage.new( code: :pubguide, stage_code: :published, type_code: :guide, abbr: ["Guide"], name: "Guide", harmonized_stages: %w[60.00 60.60], ), # Harmonization Document (HD) Pubid::Components::TypedStage.new( code: :pubhd, stage_code: :published, type_code: :hd, abbr: ["HD"], name: "Harmonization Document", harmonized_stages: %w[60.00 60.60], ), # European Specification (ES) Pubid::Components::TypedStage.new( code: :pubes, stage_code: :published, type_code: :es, abbr: ["ES"], name: "European Specification", harmonized_stages: %w[60.00 60.60], ), # CEN Report (CR) Pubid::Components::TypedStage.new( code: :pubcr, stage_code: :published, type_code: :cr, abbr: ["CR"], name: "CEN Report", harmonized_stages: %w[60.00 60.60], ), # European Prestandard (ENV) Pubid::Components::TypedStage.new( code: :pubenv, stage_code: :published, type_code: :env, abbr: ["ENV"], name: "European Prestandard", harmonized_stages: %w[60.00 60.60], ), ].freeze
- IDENTIFIER_CLASS_MAP =
Map type codes to identifier classes
{ en: "Identifiers::EuropeanNorm", ts: "Identifiers::TechnicalSpecification", tr: "Identifiers::TechnicalReport", cwa: "Identifiers::CenWorkshopAgreement", guide: "Identifiers::Guide", hd: "Identifiers::HarmonizationDocument", es: "Identifiers::EuropeanSpecification", cr: "Identifiers::CenReport", env: "Identifiers::EuropeanPrestandard", }.freeze
- DEFAULT_TYPED_STAGE =
Default typed stage for when no match is found
Pubid::Components::TypedStage.new( code: :puben, stage_code: :published, type_code: :en, abbr: ["EN"], name: "European Norm", harmonized_stages: %w[60.00 60.60], ).freeze
Instance Attribute Summary
Attributes inherited from Scheme
#identifiers, #languages, #publishers, #stages, #supplement_identifiers, #types
Instance Method Summary collapse
- #locate_identifier_klass_by_type_code(type_code) ⇒ Object
- #locate_typed_stage_by_abbr(abbr) ⇒ Object
Methods inherited from Scheme
#all_identifier_classes, #all_typed_stages, #configure, #identifier_class_index, #initialize, #locate_typed_stage_by_harmonized_code, #locate_typed_stage_by_stage_code, #supplement_typed_stages, #typed_stage_index, #typed_stages
Constructor Details
This class inherits a constructor from Pubid::Scheme
Instance Method Details
#locate_identifier_klass_by_type_code(type_code) ⇒ Object
153 154 155 156 157 158 159 160 161 |
# File 'lib/pubid/cen_cenelec/scheme.rb', line 153 def locate_identifier_klass_by_type_code(type_code) class_name = IDENTIFIER_CLASS_MAP[type_code.to_sym] return Identifiers::EuropeanNorm unless class_name # Convert string to actual class class_name.split("::").reduce(Pubid::CenCenelec) do |mod, name| mod.const_get(name) end end |
#locate_typed_stage_by_abbr(abbr) ⇒ Object
146 147 148 149 150 151 |
# File 'lib/pubid/cen_cenelec/scheme.rb', line 146 def locate_typed_stage_by_abbr(abbr) abbr_str = abbr.to_s.strip TYPED_STAGES_REGISTRY.find do |ts| ts.abbr.include?(abbr_str) end || DEFAULT_TYPED_STAGE end |