Class: Pubid::Nist::Identifiers::FederalInformationProcessingStandards
- Inherits:
-
Base
- Object
- Lutaml::Model::Serializable
- Identifier
- Base
- Pubid::Nist::Identifiers::FederalInformationProcessingStandards
- Defined in:
- lib/pubid/nist/identifiers/federal_information_processing_standards.rb
Overview
NIST Federal Information Processing Standards (FIPS) Examples:
-
“FIPS 140-3” (no NIST prefix)
-
“NIST FIPS 140-3” (also accepted, normalizes to FIPS 140-3)
Constant Summary collapse
- TYPED_STAGES =
[ Pubid::Components::TypedStage.new( abbr: ["FIPS", "NIST FIPS"], stage_code: "published", type_code: "fips", ), ].freeze
Constants inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#default_publisher ⇒ Object
FIPS identifiers default to no publisher prefix.
- #series_code ⇒ Object
-
#to_mr_style ⇒ Object
Override to_mr_style to not add “NIST” prefix for FIPS.
- #to_short_style ⇒ Object
Methods inherited from Base
#==, #append_mr_components, #append_short_components, #edition_greater?, #exclude, #extract_edition_number, #hash, #initialize, #language, #matches?, #merge, #publisher_abbreviated_name, #publisher_full_name, #render, #revision, #series_abbreviated_name, #series_full_name, #supplement_short, #to_abbreviated_style, #to_full_style, #to_s, #translation, #weight
Methods included from Pubid::Nist::Identifier
Methods included from IdentifierFacade
#from_hash, #polymorphic_type_map
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_s, #to_supplement_s, #to_urn, #urn_supplement_type, #urn_type_code, #year
Constructor Details
This class inherits a constructor from Pubid::Nist::Identifiers::Base
Class Method Details
.type ⇒ Object
24 25 26 27 28 |
# File 'lib/pubid/nist/identifiers/federal_information_processing_standards.rb', line 24 def type { key: :fips, web: :federal_information_processing_standards, title: "Federal Information Processing Standards", short: "FIPS" } end |
.typed_stages ⇒ Object
20 21 22 |
# File 'lib/pubid/nist/identifiers/federal_information_processing_standards.rb', line 20 def typed_stages TYPED_STAGES end |
Instance Method Details
#default_publisher ⇒ Object
FIPS identifiers default to no publisher prefix
36 37 38 |
# File 'lib/pubid/nist/identifiers/federal_information_processing_standards.rb', line 36 def default_publisher "" end |
#series_code ⇒ Object
31 32 33 |
# File 'lib/pubid/nist/identifiers/federal_information_processing_standards.rb', line 31 def series_code "FIPS" end |
#to_mr_style ⇒ Object
Override to_mr_style to not add “NIST” prefix for FIPS
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/pubid/nist/identifiers/federal_information_processing_standards.rb', line 41 def to_mr_style # "FIPS.46e1977" (machine-readable with dots, no publisher prefix) # Note: edition is appended directly to number without dot for FIPS result = series_code result += ".#{number}" if number # FIPS uses dash notation for parts; render here and skip the generic # part rendering in the shared tail (which appends volume, edition, # supplement, version, update, etc.). result += "-#{part.value}" if part.is_a?(Components::Part) result += parts.map { |p| "-#{p}" }.join if parts&.any? result += append_mr_components(skip_part: true) result end |
#to_short_style ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/pubid/nist/identifiers/federal_information_processing_standards.rb', line 60 def to_short_style # FIPS format: "FIPS 14e1971" or "NIST FIPS 140-3" (preserve publisher if set) result = publisher ? "#{publisher} " : "" result += series_code if number # Convert dash-year patterns to edition format for FIPS # Pattern: "14-1971" → "14e1971" (edition year format) # But preserve dash for parts: "140-3" stays as-is if number.value =~ /^(\d{1,3})-(\d{4})$/ # This is a number-year pattern (e.g., "14-1971") # Convert to edition format: "14e1971" number_part = $1 year_part = $2 result += " #{number_part}e#{year_part}" else result += " #{number.value}" end end # FIPS uses dash notation for parts: -1, -2, -3 (not pt1, pt2, pt3), # so render the part here and skip the generic part rendering in the # shared tail. The tail still appends volume, edition, version, # supplement, update, etc. — components FIPS previously dropped. if part.is_a?(Components::Part) result += "-#{part.value}" end result += append_short_components(skip_part: true) result end |