Class: Pubid::Bsi::Identifiers::ConsolidatedIdentifier
- Inherits:
-
SingleIdentifier
- Object
- Pubid::Bsi::Identifiers::ConsolidatedIdentifier
- Defined in:
- lib/pubid/bsi/identifiers/consolidated_identifier.rb
Overview
Consolidated Identifier - contains base document plus supplements Example: "BS 4592-0:2006+A1:2012" = [BS 4592-0:2006, Amendment 1:2012]
Instance Method Summary collapse
- #date ⇒ Object
- #number ⇒ Object
- #part ⇒ Object
- #parts ⇒ Object
-
#publisher ⇒ Object
Delegate to first identifier (base document).
- #to_urn ⇒ Object
- #type ⇒ Object
- #year ⇒ Object
Instance Method Details
#date ⇒ Object
46 47 48 49 |
# File 'lib/pubid/bsi/identifiers/consolidated_identifier.rb', line 46 def date base = identifiers&.first base.date if base&.class&.attributes&.key?(:date) end |
#number ⇒ Object
37 38 39 |
# File 'lib/pubid/bsi/identifiers/consolidated_identifier.rb', line 37 def number identifiers&.first&.number end |
#part ⇒ Object
56 57 58 59 |
# File 'lib/pubid/bsi/identifiers/consolidated_identifier.rb', line 56 def part base = identifiers&.first base.part if base&.class&.attributes&.key?(:part) end |
#parts ⇒ Object
51 52 53 54 |
# File 'lib/pubid/bsi/identifiers/consolidated_identifier.rb', line 51 def parts base = identifiers&.first base.parts if base&.class&.attributes&.key?(:parts) end |
#publisher ⇒ Object
Delegate to first identifier (base document)
33 34 35 |
# File 'lib/pubid/bsi/identifiers/consolidated_identifier.rb', line 33 def publisher identifiers&.first&.publisher end |
#to_urn ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/pubid/bsi/identifiers/consolidated_identifier.rb', line 12 def to_urn base = identifiers&.first return nil unless base urn = base.to_urn if base.class.method_defined?(:to_urn) return urn unless urn # Append supplement info to URN identifiers[1..].each do |id| if id.is_a?(Amendment) urn += ":amd:#{id.amendment_number}" urn += ":#{id.amendment_year}" if id.amendment_year elsif id.is_a?(Corrigendum) urn += ":cor:#{id.corrigendum_number}" urn += ":#{id.corrigendum_year}" if id.corrigendum_year end end urn end |
#type ⇒ Object
61 62 63 64 |
# File 'lib/pubid/bsi/identifiers/consolidated_identifier.rb', line 61 def type base = identifiers&.first base.type if base&.class&.attributes&.key?(:type) end |
#year ⇒ Object
41 42 43 44 |
# File 'lib/pubid/bsi/identifiers/consolidated_identifier.rb', line 41 def year base = identifiers&.first base.year if base&.class&.attributes&.key?(:year) end |