Class: Pubid::Iso::BundledIdentifier
Overview
Identifier that represents a bundled identifier with base document and supplements E.g., “ISO/IEC DIR 1 + IEC SUP:2016-05” or “ISO/IEC DIR 1:2022 + IEC SUP:2022”
Constant Summary
Constants inherited
from Identifier
Identifier::ISO_TYPE_MAP
Instance Method Summary
collapse
Methods inherited from Identifier
build_type_map, 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, #urn_supplement_type, #urn_type_code
Instance Method Details
#copublishers ⇒ Object
34
35
36
|
# File 'lib/pubid/iso/bundled_identifier.rb', line 34
def copublishers
base_document&.copublishers
end
|
#date ⇒ Object
26
27
28
|
# File 'lib/pubid/iso/bundled_identifier.rb', line 26
def date
base_document&.date
end
|
#number ⇒ Object
18
19
20
|
# File 'lib/pubid/iso/bundled_identifier.rb', line 18
def number
base_document&.number
end
|
#part ⇒ Object
22
23
24
|
# File 'lib/pubid/iso/bundled_identifier.rb', line 22
def part
base_document&.part
end
|
#publisher ⇒ Object
Delegate key attributes to base_document for easier access in tests
14
15
16
|
# File 'lib/pubid/iso/bundled_identifier.rb', line 14
def publisher
base_document&.publisher
end
|
#to_s(lang: :en, lang_single: false, with_edition: false, format: nil, stage_format_long: nil, with_date: nil) ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/pubid/iso/bundled_identifier.rb', line 38
def to_s(lang: :en, lang_single: false, with_edition: false, format: nil,
stage_format_long: nil, with_date: nil)
parts = [base_document.to_s(lang: lang, lang_single: lang_single,
with_edition: with_edition, format: format, stage_format_long: stage_format_long, with_date: with_date)]
supplements.each do |supplement|
supplement_str = supplement.to_supplement_s(lang: lang, lang_single: lang_single,
with_edition: with_edition, format: format, stage_format_long: stage_format_long, with_date: with_date)
parts << "+ #{supplement_str}"
end
parts.join(" ")
end
|
#to_urn ⇒ Object
Generate URN for bundled identifier Format: urn:iso:doc:base_urn:supplement_urn_parts Example: urn:iso:doc:iso-iec:dir:1:2022:iec:sup:2022
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/pubid/iso/bundled_identifier.rb', line 56
def to_urn
base_urn = base_document.to_urn
base_parts = base_urn.split(":").drop(1)
urn_parts = ["urn"]
urn_parts.concat(base_parts)
supplements.each do |supplement|
sup_urn = supplement.to_urn
if supplement.is_a?(Identifiers::DirectivesSupplement)
else
end
sup_parts = sup_urn.split(":").drop(3)
urn_parts.concat(sup_parts)
end
urn_parts.join(":")
end
|
#typed_stage ⇒ Object
30
31
32
|
# File 'lib/pubid/iso/bundled_identifier.rb', line 30
def typed_stage
base_document&.typed_stage
end
|