Class: Pubid::Iec::Identifiers::Base
- Inherits:
-
SingleIdentifier
- Object
- Lutaml::Model::Serializable
- Pubid::Identifier
- Pubid::Iec::Identifier
- SingleIdentifier
- Pubid::Iec::Identifiers::Base
- Defined in:
- lib/pubid/iec/identifiers/base.rb
Overview
Base class for all IEC identifiers Inherits from SingleIdentifier to get common functionality Single Responsibility: Common IEC identifier attributes and behavior
Direct Known Subclasses
ComponentSpecification, ConformityAssessment, Guide, InternationalStandard, OperationalDocument, PubliclyAvailableSpecification, SocietalTechnologyTrendReport, SystemsReferenceDocument, TechnicalReport, TechnicalSpecification, TechnologyReport, TestReportForm, WhitePaper, WorkingDocument
Constant Summary
Constants inherited from Pubid::Iec::Identifier
Pubid::Iec::Identifier::EXTRA_CREATE_KLASS_FILES
Class Method Summary collapse
Instance Method Summary collapse
- #number_portion ⇒ Object
- #to_s(_format = :short) ⇒ Object
-
#validate! ⇒ Object
Validate IEC-specific constraints.
Methods inherited from SingleIdentifier
#edition_portion, #language_portion, #publisher_portion
Methods inherited from Pubid::Iec::Identifier
Methods inherited from Pubid::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
Class Method Details
.type ⇒ Object
65 66 67 |
# File 'lib/pubid/iec/identifiers/base.rb', line 65 def self.type raise NotImplementedError, "Subclass must implement self.type method" end |
Instance Method Details
#number_portion ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/pubid/iec/identifiers/base.rb', line 48 def number_portion return "" unless number result = " #{number}" # Add part if present result += "-#{part}" if part && part.to_s != "" # Add subpart if present result += "-#{subpart}" if subpart && subpart.to_s != "" # Add date if present result += ":#{date.year}" if date result end |
#to_s(_format = :short) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/pubid/iec/identifiers/base.rb', line 23 def to_s(_format = :short) parts = [] # Publisher and type portion (from typed_stage) - uses inherited method parts << publisher_portion # Number portion (number with part/subpart) parts << number_portion # Edition if present - add space before edition parts << " #{edition}" if edition&.number # VAP suffix parts << vap_suffix.render_with_space if vap_suffix # Database flag parts << " DB" if database # All-parts marker — rendered the same as the generic # HumanReadable renderer for parity (see Pubid::Renderers::HumanReadable#render). parts << " (all parts)" if all_parts parts.compact.join end |
#validate! ⇒ Object
Validate IEC-specific constraints
70 71 72 73 74 75 76 77 78 |
# File 'lib/pubid/iec/identifiers/base.rb', line 70 def validate! super if defined?(super) # Validate VAP suffix if present vap_suffix&.validate! # Validate TRF info if present trf_info&.validate! if trf_info && !trf_info.empty? end |