Class: Pubid::Nist::Identifiers::MiscellaneousPublication

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

Overview

NBS MP (Miscellaneous Publication) Identifier Examples:

  • "NBS MP 39e1" - Edition with "e" notation
  • "NBS MP 260e1965" - Edition with year as edition ID NOTE: Parenthetical edition format (e.g., "39(1)") does NOT exist for MP identifiers

Constant Summary collapse

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.typeObject



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

def type
  { key: :mp,
  web: :miscellaneous_publication, title: "Miscellaneous Publication", short: "MP" }
end

.typed_stagesObject



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

def typed_stages
  TYPED_STAGES
end

Instance Method Details

#default_publisherObject



31
32
33
# File 'lib/pubid/nist/identifiers/miscellaneous_publication.rb', line 31

def default_publisher
  "NBS"
end

#series_codeObject



35
36
37
# File 'lib/pubid/nist/identifiers/miscellaneous_publication.rb', line 35

def series_code
  "MP"
end

#to_mr_styleObject



57
58
59
60
61
62
# File 'lib/pubid/nist/identifiers/miscellaneous_publication.rb', line 57

def to_mr_style
  result = "#{default_publisher}.#{series_code}"
  result += ".#{number.value}" if number
  result += append_mr_components
  result
end

#to_s(format = :short) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/pubid/nist/identifiers/miscellaneous_publication.rb', line 39

def to_s(format = :short)
  case format
  when :mr
    to_mr_style
  else
    to_short_style
  end
end

#to_short_styleObject



50
51
52
53
54
55
# File 'lib/pubid/nist/identifiers/miscellaneous_publication.rb', line 50

def to_short_style
  result = "#{default_publisher} #{series_code}"
  result += " #{number.value}" if number
  result += append_short_components
  result
end