Class: Pubid::Iec::Identifiers::ConsolidatedIdentifier
Overview
Consolidated Identifier Single Responsibility: Represents a consolidated publication containing multiple documents Example: “IEC 60529:1989+AMD1:1999” contains [IS, AMD] as separate identifier objects This is MODEL-DRIVEN: stores the actual identifiers, not just renders with +
Instance Method Summary
collapse
parse
#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
Instance Method Details
#base_document ⇒ Object
Get the base document (first identifier)
75
76
77
|
# File 'lib/pubid/iec/identifiers/consolidated_identifier.rb', line 75
def base_document
identifiers&.first
end
|
#code ⇒ Object
50
51
52
|
# File 'lib/pubid/iec/identifiers/consolidated_identifier.rb', line 50
def code
identifiers&.first&.code
end
|
#copublishers ⇒ Object
46
47
48
|
# File 'lib/pubid/iec/identifiers/consolidated_identifier.rb', line 46
def copublishers
identifiers&.first&.copublishers
end
|
#date ⇒ Object
58
59
60
|
# File 'lib/pubid/iec/identifiers/consolidated_identifier.rb', line 58
def date
identifiers&.first&.date
end
|
#number ⇒ Object
54
55
56
|
# File 'lib/pubid/iec/identifiers/consolidated_identifier.rb', line 54
def number
identifiers&.first&.number
end
|
#publisher ⇒ Object
Delegate common attributes to first identifier (base document)
42
43
44
|
# File 'lib/pubid/iec/identifiers/consolidated_identifier.rb', line 42
def publisher
identifiers&.first&.publisher
end
|
#stage ⇒ Object
66
67
68
|
# File 'lib/pubid/iec/identifiers/consolidated_identifier.rb', line 66
def stage
identifiers&.first&.stage
end
|
#supplements ⇒ Object
Get all supplements (identifiers after first)
80
81
82
|
# File 'lib/pubid/iec/identifiers/consolidated_identifier.rb', line 80
def supplements
identifiers&.drop(1) || []
end
|
#to_s(lang: :en, lang_single: false, with_edition: false) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/pubid/iec/identifiers/consolidated_identifier.rb', line 14
def to_s(lang: :en, lang_single: false, with_edition: false)
identifiers.map.with_index do |id, idx|
if idx.zero?
id.to_s(lang: lang, lang_single: lang_single,
with_edition: with_edition)
elsif id.is_a?(Amendment)
if id.date&.year && !id.date.year.empty?
"+AMD#{id.number}:#{id.date.year}"
else
"+AMD#{id.number}"
end
elsif id.is_a?(Corrigendum)
if id.date&.year && !id.date.year.empty?
"+COR#{id.number}:#{id.date.year}"
else
"+COR#{id.number}"
end
else
"+#{id.to_s(lang: lang, lang_single: lang_single,
with_edition: with_edition)}"
end
end.join
end
|
#type ⇒ Object
62
63
64
|
# File 'lib/pubid/iec/identifiers/consolidated_identifier.rb', line 62
def type
:consolidated
end
|
#typed_stage ⇒ Object
70
71
72
|
# File 'lib/pubid/iec/identifiers/consolidated_identifier.rb', line 70
def typed_stage
identifiers&.first&.typed_stage
end
|