Class: Pubid::Bsi::Identifiers::Amendment

Inherits:
Base
  • Object
show all
Defined in:
lib/pubid/bsi/identifiers/amendment.rb

Overview

Amendment Identifier Contains a base identifier plus amendment parameters

Instance Method Summary collapse

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::Identifier

Instance Method Details

#publisherObject



34
35
36
# File 'lib/pubid/bsi/identifiers/amendment.rb', line 34

def publisher
  base_identifier&.publisher
end

#to_sObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/pubid/bsi/identifiers/amendment.rb', line 14

def to_s
  if base_identifier
    if amendment_year
      "#{base_identifier}#{separator}A#{amendment_number}:#{amendment_year}"
    elsif amendment_number&.match?(/^[A-Z]+$/)
      # Letter suffixes (AA, AB, etc.) have a space, numeric suffixes don't
      "#{base_identifier} AMD #{amendment_number}"
    else
      "#{base_identifier} AMD#{amendment_number}"
    end
  elsif amendment_year
    "#{separator}A#{amendment_number}:#{amendment_year}"
  elsif amendment_number&.match?(/^[A-Z]+$/)
    # Letter suffixes (AA, AB, etc.) have a space, numeric suffixes don't
    "AMD #{amendment_number}"
  else
    "AMD#{amendment_number}"
  end
end