Class: Pubid::CenCenelec::Identifiers::ConsolidatedIdentifier
- Inherits:
-
Base
- Object
- Lutaml::Model::Serializable
- Identifier
- Base
- Pubid::CenCenelec::Identifiers::ConsolidatedIdentifier
show all
- Defined in:
- lib/pubid/cen_cenelec/identifiers/consolidated_identifier.rb
Overview
Consolidated Identifier - contains base document plus supplements Example: “EN 196-3:2005+A1:2008” = [EN 196-3:2005, Amendment(base + params)]
Instance Method Summary
collapse
Methods inherited from Base
#==
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
Instance Method Details
#number ⇒ Object
43
44
45
|
# File 'lib/pubid/cen_cenelec/identifiers/consolidated_identifier.rb', line 43
def number
identifiers&.first&.number
end
|
#parts ⇒ Object
51
52
53
|
# File 'lib/pubid/cen_cenelec/identifiers/consolidated_identifier.rb', line 51
def parts
identifiers&.first&.parts
end
|
#publisher ⇒ Object
Delegate to first identifier (base document)
39
40
41
|
# File 'lib/pubid/cen_cenelec/identifiers/consolidated_identifier.rb', line 39
def publisher
identifiers&.first&.publisher
end
|
#to_s ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/pubid/cen_cenelec/identifiers/consolidated_identifier.rb', line 11
def to_s
identifiers.map.with_index do |id, idx|
if idx.zero?
id.to_s
elsif id.is_a?(Amendment)
result = "+A#{id.amendment_number}"
result += ":#{id.amendment_year}" if id.amendment_year
result
elsif id.is_a?(Corrigendum)
result = "+AC"
result += id.corrigendum_number if id.corrigendum_number && !id.corrigendum_number.empty?
if id.corrigendum_year
result += ":#{id.corrigendum_year}"
result += "-#{id.corrigendum_month}" if id.corrigendum_month && !id.corrigendum_month.empty?
end
result
else
"+#{id}"
end
end.compact.join
end
|
#type ⇒ Object
55
56
57
|
# File 'lib/pubid/cen_cenelec/identifiers/consolidated_identifier.rb', line 55
def type
identifiers&.first&.type
end
|
#year ⇒ Object
47
48
49
|
# File 'lib/pubid/cen_cenelec/identifiers/consolidated_identifier.rb', line 47
def year
identifiers&.first&.year
end
|