Class: Pubid::Etsi::Identifiers::SupplementIdentifier
- Inherits:
-
Base
- Object
- Lutaml::Model::Serializable
- Identifier
- Base
- Pubid::Etsi::Identifiers::SupplementIdentifier
- Defined in:
- lib/pubid/etsi/identifiers/supplement_identifier.rb
Overview
Base class for ETSI supplements (Amendment, Corrigendum)
Direct Known Subclasses
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#base_hash ⇒ Object
Include supplement notation in serialization.
- #code ⇒ Object
-
#collect_supplement_notations(current_supplement, notations) ⇒ Object
Recursively collect supplement notations from the supplement chain.
- #date ⇒ Object
-
#find_actual_base(current_base) ⇒ Object
Find the actual base ETSI standard (not supplements).
- #supplement_notation ⇒ Object
-
#to_s ⇒ Object
Render via renderer.
-
#type ⇒ Object
Inherit attributes from base.
- #version ⇒ Object
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, #year
Constructor Details
This class inherits a constructor from Pubid::Identifier
Instance Method Details
#==(other) ⇒ Object
62 63 64 65 66 67 |
# File 'lib/pubid/etsi/identifiers/supplement_identifier.rb', line 62 def ==(other) return false unless other.is_a?(SupplementIdentifier) return false unless other.class == self.class base == other.base && number == other.number end |
#base_hash ⇒ Object
Include supplement notation in serialization
70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/pubid/etsi/identifiers/supplement_identifier.rb', line 70 def base_hash hash = super # ETSI supplements need the type (e.g., "ETS", "TR") from the base document if base.class.attributes.key?(:type) && base.type hash[:type] = base.type end hash[:supplement_notation] = supplement_notation hash[:supplement_type] = self.class.name.split("::").last.downcase hash end |
#code ⇒ Object
16 17 18 |
# File 'lib/pubid/etsi/identifiers/supplement_identifier.rb', line 16 def code base.code end |
#collect_supplement_notations(current_supplement, notations) ⇒ Object
Recursively collect supplement notations from the supplement chain
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/pubid/etsi/identifiers/supplement_identifier.rb', line 34 def collect_supplement_notations(current_supplement, notations) if current_supplement.is_a?(SupplementIdentifier) # Add this supplement's notation at the beginning (because supplements wrap from outside in) notations.unshift("/#{current_supplement.supplement_notation}") # Continue collecting from the base if it's also a supplement if current_supplement.base.is_a?(SupplementIdentifier) collect_supplement_notations(current_supplement.base, notations) else notations end else notations end end |
#date ⇒ Object
24 25 26 |
# File 'lib/pubid/etsi/identifiers/supplement_identifier.rb', line 24 def date base.date end |
#find_actual_base(current_base) ⇒ Object
Find the actual base ETSI standard (not supplements)
50 51 52 53 54 55 56 |
# File 'lib/pubid/etsi/identifiers/supplement_identifier.rb', line 50 def find_actual_base(current_base) if current_base.is_a?(SupplementIdentifier) find_actual_base(current_base.base) else current_base end end |
#supplement_notation ⇒ Object
58 59 60 |
# File 'lib/pubid/etsi/identifiers/supplement_identifier.rb', line 58 def supplement_notation raise NotImplementedError end |
#to_s ⇒ Object
Render via renderer
29 30 31 |
# File 'lib/pubid/etsi/identifiers/supplement_identifier.rb', line 29 def to_s render(format: :human) end |
#type ⇒ Object
Inherit attributes from base
12 13 14 |
# File 'lib/pubid/etsi/identifiers/supplement_identifier.rb', line 12 def type base.type end |
#version ⇒ Object
20 21 22 |
# File 'lib/pubid/etsi/identifiers/supplement_identifier.rb', line 20 def version base.version end |