Class: Pubid::Bsi::Identifiers::ValueAddedPublication

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

Overview

Value-Added Publication Identifier Wraps base identifier with format suffix (PDF, TC, BOOK) Similar to IEC VapIdentifier and BSI ExpertCommentary

Examples:

PD 5500:2018+A3:2020 PDF
PAS 96:2017 - TC
PP 7722:2006 BOOK

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

#dateObject



46
47
48
# File 'lib/pubid/bsi/identifiers/value_added_publication.rb', line 46

def date
  base_identifier&.date
end

#numberObject



38
39
40
# File 'lib/pubid/bsi/identifiers/value_added_publication.rb', line 38

def number
  base_identifier&.number
end

#publisherObject

Delegate common attributes to base_identifier



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

def publisher
  base_identifier&.publisher
end

#to_s(lang: :en, lang_single: false) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/pubid/bsi/identifiers/value_added_publication.rb', line 18

def to_s(lang: :en, lang_single: false)
  base_str = base_identifier.to_s(lang: lang, lang_single: lang_single)

  case format
  when "TC"
    "#{base_str} - TC"
  when "PDF"
    "#{base_str} PDF"
  when "BOOK"
    "#{base_str} BOOK"
  else
    base_str
  end
end

#yearObject



42
43
44
# File 'lib/pubid/bsi/identifiers/value_added_publication.rb', line 42

def year
  base_identifier&.year
end