Class: Pubid::Bsi::Identifiers::AdoptedInternationalStandard

Inherits:
BritishStandard show all
Defined in:
lib/pubid/bsi/identifiers/adopted_international_standard.rb

Overview

AdoptedInternationalStandard wraps ISO/IEC identifiers directly Example: “BS ISO 8601:2019” where ISO 8601:2019 is an ISO identifier object Example: “BS IEC 62600:2020” where IEC 62600:2020 is an IEC identifier object

Constant Summary

Constants inherited from BritishStandard

BritishStandard::TYPED_STAGES

Instance Method Summary collapse

Methods inherited from BritishStandard

type

Methods inherited from SingleIdentifier

#<=>, #publisher

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



68
69
70
# File 'lib/pubid/bsi/identifiers/adopted_international_standard.rb', line 68

def date
  adopted_identifier&.date if adopted_identifier&.methods&.include?(:date)
end

#numberObject

Delegate common methods to adopted identifier



60
61
62
# File 'lib/pubid/bsi/identifiers/adopted_international_standard.rb', line 60

def number
  adopted_identifier&.number
end

#partObject



76
77
78
# File 'lib/pubid/bsi/identifiers/adopted_international_standard.rb', line 76

def part
  adopted_identifier&.part if adopted_identifier&.methods&.include?(:part)
end

#partsObject



72
73
74
# File 'lib/pubid/bsi/identifiers/adopted_international_standard.rb', line 72

def parts
  adopted_identifier&.parts if adopted_identifier&.methods&.include?(:parts)
end

#to_sObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/pubid/bsi/identifiers/adopted_international_standard.rb', line 19

def to_s
  # Get the BSI prefix (BS, PD, DD)
  prefix = case publisher
           when Components::Publisher
             publisher.body
           when Array
             publisher.join("/")
           when String
             publisher
           else
             "BS"
           end

  result = prefix
  result += " #{adopted_identifier}" if adopted_identifier
  result += " ED#{edition}" if edition

  # Reaffirmation notation like (R2004)
  result += " (R#{reaffirmation_year})" if reaffirmation_year

  # Translation - normalize to just "(Language)" format
  # "(French version)", "(French Translation)", "(French)" all become "(French)"
  if translation_lang
    result += " (#{translation_lang})"
  elsif translation_upper
    result += " (#{translation_upper})"
  end

  # ExpertCommentary suffix
  if expert_commentary
    result += if expert_commentary_topic
                " ExComm (#{expert_commentary_topic})"
              else
                " ExComm"
              end
  end

  result
end

#yearObject



64
65
66
# File 'lib/pubid/bsi/identifiers/adopted_international_standard.rb', line 64

def year
  adopted_identifier&.year if adopted_identifier&.methods&.include?(:year)
end