Class: Pubid::Nist::Identifiers::InteragencyReport

Inherits:
Base
  • Object
show all
Defined in:
lib/pubid/nist/identifiers/internal_report.rb

Overview

NIST Interagency Report (IR) / NISTIR Examples:

  • “NIST IR 8115” = Interagency Report 8115

  • “NIST IR 8115r1” = Interagency Report 8115 revision 1

  • “NBS IR 73-197” = NBS Interagency Report 73-197

Constant Summary collapse

TYPED_STAGES =
[
  Pubid::Components::TypedStage.new(
    abbr: ["IR", "NIST IR", "NBS IR"],
    stage_code: "published",
    type_code: "ir",
  ),
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#edition_greater?, #extract_edition_number, #initialize, #language, #merge, #publisher, #revision, #translation, #weight

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

Constructor Details

This class inherits a constructor from Pubid::Nist::Identifiers::Base

Class Method Details

.typeObject



25
26
27
# File 'lib/pubid/nist/identifiers/internal_report.rb', line 25

def type
  { key: :ir, title: "NIST Interagency Report", short: "IR" }
end

.typed_stagesObject



21
22
23
# File 'lib/pubid/nist/identifiers/internal_report.rb', line 21

def typed_stages
  TYPED_STAGES
end

Instance Method Details

#series_codeObject



30
31
32
# File 'lib/pubid/nist/identifiers/internal_report.rb', line 30

def series_code
  "IR"
end

#to_s(format = nil) ⇒ String

Override to_s to normalize MR input to short format by default But allow explicit format requests (e.g., format: :mr)

Parameters:

  • format (Symbol, Hash, nil) (defaults to: nil)

    output format

Returns:

  • (String)

    formatted identifier



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/pubid/nist/identifiers/internal_report.rb', line 38

def to_s(format = nil)
  # Handle both keyword argument (hash) and positional argument (symbol/string)
  effective_format = if format.is_a?(Hash)
                       format[:format]
                     else
                       format
                     end

  # If explicit format is specified, use it. Otherwise, default to short.
  if effective_format.nil?
    super(:short)
  else
    super(effective_format)
  end
end