Module: Pubid::Nist
- Extended by:
- PrefixesSupport
- Defined in:
- lib/pubid/nist.rb,
lib/pubid/nist/caster.rb,
lib/pubid/nist/parser.rb,
lib/pubid/nist/router.rb,
lib/pubid/nist/series.rb,
lib/pubid/nist/builder.rb,
lib/pubid/nist/renderer.rb,
lib/pubid/nist/series/ir.rb,
lib/pubid/nist/components.rb,
lib/pubid/nist/urn_parser.rb,
lib/pubid/nist/identifiers.rb,
lib/pubid/nist/series/base.rb,
lib/pubid/nist/series/crpl.rb,
lib/pubid/nist/series/fips.rb,
lib/pubid/nist/series/mono.rb,
lib/pubid/nist/preprocessor.rb,
lib/pubid/nist/configuration.rb,
lib/pubid/nist/series/ncstar.rb,
lib/pubid/nist/urn_generator.rb,
lib/pubid/nist/components/code.rb,
lib/pubid/nist/components/part.rb,
lib/pubid/nist/components/stage.rb,
lib/pubid/nist/identifiers/base.rb,
lib/pubid/nist/components/update.rb,
lib/pubid/nist/components/volume.rb,
lib/pubid/nist/identifiers/nsrds.rb,
lib/pubid/nist/identifiers/owmwp.rb,
lib/pubid/nist/components/edition.rb,
lib/pubid/nist/components/version.rb,
lib/pubid/nist/identifiers/ncstar.rb,
lib/pubid/nist/identifiers/report.rb,
lib/pubid/nist/identifiers/circular.rb,
lib/pubid/nist/identifiers/handbook.rb,
lib/pubid/nist/components/supplement.rb,
lib/pubid/nist/identifiers/monograph.rb,
lib/pubid/nist/supplement_identifier.rb,
lib/pubid/nist/components/translation.rb,
lib/pubid/nist/components/issue_number.rb,
lib/pubid/nist/identifiers/crpl_report.rb,
lib/pubid/nist/parser_output_normalizer.rb,
lib/pubid/nist/series/letter_preserving.rb,
lib/pubid/nist/identifiers/dated_document.rb,
lib/pubid/nist/identifiers/technical_note.rb,
lib/pubid/nist/circular_supplement_builder.rb,
lib/pubid/nist/identifiers/internal_report.rb,
lib/pubid/nist/identifiers/letter_circular.rb,
lib/pubid/nist/identifiers/circular_supplement.rb,
lib/pubid/nist/identifiers/commercial_standard.rb,
lib/pubid/nist/identifiers/special_publication.rb,
lib/pubid/nist/identifiers/grant_contractor_report.rb,
lib/pubid/nist/identifiers/miscellaneous_publication.rb,
lib/pubid/nist/identifiers/commercial_standards_monthly.rb,
lib/pubid/nist/identifiers/commercial_standard_emergency.rb,
lib/pubid/nist/identifiers/federal_information_processing_standards.rb
Defined Under Namespace
Modules: Components, Identifiers, Series Classes: Builder, Caster, CircularSupplementBuilder, Configuration, ConfigurationError, Identifier, Parser, ParserOutputNormalizer, Preprocessor, Renderer, Router, SupplementIdentifier, UrnGenerator, UrnParser
Constant Summary collapse
- PREFIXES =
Publisher prefixes (NBS/NIST) plus the "simple series" tokens that can begin a printed reference on their own — mirrors the parser's
publisherandsimple_seriesrules (lib/pubid/nist/parser.rb). Compound series that only appear glued to a publisher (e.g. "NBS CRPL-F-A") are excluded because they never lead a routable reference by themselves. %w[ NIST NBS AMS VTS BSS BMS BH FIPS GCR HB MONO MP NCSTAR NSRDS IR SP TN CSWP AI CIRC CS CSM CRPL LCIRC OWMWP PC RPT SIBS TIBM TTB EAB JPCRD JRES ].freeze
- IDENTIFIER_TYPES =
Explicit registry of NIST identifier classes.
NIST identifier classes use
typed_stages(not theself.typeHash pattern used by CEN/JCGM/ANSI), so they cannot be auto-discovered. Identifiers::Base is the fallback for unmapped series (e.g. AMS, VTS) and must be excluded from typed-stage aggregation. [ Identifiers::SpecialPublication, Identifiers::FederalInformationProcessingStandards, Identifiers::InteragencyReport, Identifiers::Handbook, Identifiers::TechnicalNote, Identifiers::Circular, Identifiers::CircularSupplement, Identifiers::CrplReport, Identifiers::Report, Identifiers::Monograph, Identifiers::MiscellaneousPublication, Identifiers::GrantContractorReport, Identifiers::Ncstar, Identifiers::Owmwp, Identifiers::Nsrds, Identifiers::LetterCircular, Identifiers::CommercialStandard, Identifiers::CommercialStandardEmergency, Identifiers::CommercialStandardsMonthly, Identifiers::DatedDocument, Identifiers::Base, # Fallback for unmapped series ].freeze
Class Method Summary collapse
-
.all_typed_stages ⇒ Array<Pubid::Components::TypedStage>
Aggregate TYPED_STAGES from all identifier classes.
-
.configuration ⇒ Configuration
Get the configuration instance.
-
.identifier_types ⇒ Array<Class>
All identifier classes for external consumption (export, website).
-
.locate_stage(abbr) ⇒ Pubid::Components::TypedStage?
Lookup: abbreviation -> typed stage.
-
.locate_type(code) ⇒ Class?
Lookup: type code -> identifier class.
-
.parse(identifier) ⇒ Identifiers::Base
Parse a NIST identifier string.
Methods included from PrefixesSupport
Class Method Details
.all_typed_stages ⇒ Array<Pubid::Components::TypedStage>
Aggregate TYPED_STAGES from all identifier classes. Identifiers::Base is excluded because it has no typed stages and acts as the fallback for unmapped series.
104 105 106 107 108 109 |
# File 'lib/pubid/nist.rb', line 104 def self.all_typed_stages @all_typed_stages ||= identifier_types .reject { |klass| klass == Identifiers::Base } .flat_map(&:typed_stages) .freeze end |
.configuration ⇒ Configuration
Get the configuration instance
84 85 86 |
# File 'lib/pubid/nist.rb', line 84 def self.configuration @configuration ||= Configuration.new end |
.identifier_types ⇒ Array<Class>
All identifier classes for external consumption (export, website). Identifiers::Base is the fallback for unmapped series and is excluded from external type listings.
96 97 98 |
# File 'lib/pubid/nist.rb', line 96 def self.identifier_types IDENTIFIER_TYPES.reject { |klass| klass == Identifiers::Base } end |
.locate_stage(abbr) ⇒ Pubid::Components::TypedStage?
Lookup: abbreviation -> typed stage
125 126 127 128 |
# File 'lib/pubid/nist.rb', line 125 def self.locate_stage(abbr) abbr_str = abbr.to_s.upcase all_typed_stages.find { |s| s.abbr.any? { |a| a.to_s.upcase == abbr_str } } end |
.locate_type(code) ⇒ Class?
Lookup: type code -> identifier class. Identifiers::Base is excluded so it never gets selected by type code.
115 116 117 118 119 120 |
# File 'lib/pubid/nist.rb', line 115 def self.locate_type(code) type_str = code.to_s identifier_types .reject { |klass| klass == Identifiers::Base } .find { |klass| klass.typed_stages.any? { |ts| ts.type_code.to_s == type_str } } end |
.parse(identifier) ⇒ Identifiers::Base
Parse a NIST identifier string
68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/pubid/nist.rb', line 68 def self.parse(identifier) if identifier.length > Pubid::MAX_INPUT_LENGTH raise ArgumentError, Pubid::INPUT_TOO_LONG_MESSAGE end # Use the Parser class's preprocessing method # Note: We call the class method directly to ensure preprocessing is applied parsed = Parser.class_parse_with_preprocessing(identifier) # Builder is stateless — lookups go through this module (Pubid::Nist) builder = Builder.new builder.build(parsed) end |