Class: Pubid::Bsi::Identifiers::AdoptedEuropeanNorm

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

Overview

AdoptedEuropeanNorm wraps CEN identifiers Example: “BS EN 10077-1:2006” where EN 10077-1:2006 is a CEN identifier object Example: “BS EN ISO 8601:2019” where EN ISO 8601:2019 is a CEN AdoptedEuropeanNorm wrapping ISO

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



77
78
79
# File 'lib/pubid/bsi/identifiers/adopted_european_norm.rb', line 77

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

#numberObject

Delegate common methods to adopted identifier



69
70
71
# File 'lib/pubid/bsi/identifiers/adopted_european_norm.rb', line 69

def number
  adopted_identifier&.number
end

#partObject



85
86
87
# File 'lib/pubid/bsi/identifiers/adopted_european_norm.rb', line 85

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

#partsObject



81
82
83
# File 'lib/pubid/bsi/identifiers/adopted_european_norm.rb', line 81

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

#subpartObject



89
90
91
# File 'lib/pubid/bsi/identifiers/adopted_european_norm.rb', line 89

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

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



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
58
59
60
61
62
63
64
65
66
# File 'lib/pubid/bsi/identifiers/adopted_european_norm.rb', line 19

def to_s(lang: :en, lang_single: false)
  # 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 - preserve the "version" or "Translation" suffix if present
  if translation_lang
    result += if translation_suffix_type == "version"
                " (#{translation_lang} version)"
              elsif translation_suffix_type == "Translation"
                " (#{translation_lang} Translation)"
              else
                " (#{translation_lang})"
              end
  elsif translation_upper
    result += if translation_suffix_type == "Translation"
                " (#{translation_upper} Translation)"
              else
                " (#{translation_upper})"
              end
  end

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

  result
end

#yearObject



73
74
75
# File 'lib/pubid/bsi/identifiers/adopted_european_norm.rb', line 73

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