Class: Pubid::CenCenelec::Identifier
- Inherits:
-
Identifier
- Object
- Lutaml::Model::Serializable
- Identifier
- Pubid::CenCenelec::Identifier
- Defined in:
- lib/pubid/cen_cenelec/identifier.rb
Overview
Common base class for all CEN/CENELEC identifiers. CEN/CENELEC has a split
hierarchy — some concrete types descend from Identifiers::Base, others from
SingleIdentifier — so this class is the shared parent of BOTH, making every
CEN/CENELEC identifier is_a?(Pubid::CenCenelec::Identifier) natively (and
giving them the shared polymorphic from_hash). No facade needed.
Direct Known Subclasses
Class Method Summary collapse
Methods inherited from Identifier
#base_identifier, #eql?, #exclude, from_hash, #hash, #initialize, #mr_number, #mr_number_with_part, #mr_part, #mr_publisher, #mr_type, #mr_year, #new_edition_of?, polymorphic_name, polymorphic_type_map, #render, #resolve_urn_generator, #root, #to_hash, #to_mr_string, #to_s, #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
.parse(identifier) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/pubid/cen_cenelec/identifier.rb', line 11 def self.parse(identifier) if identifier.length > Pubid::MAX_INPUT_LENGTH raise ArgumentError, Pubid::INPUT_TOO_LONG_MESSAGE end parsed = Parser.parse(identifier) Builder.new.build(parsed) rescue Parslet::ParseFailed => e raise "Failed to parse CEN identifier '#{identifier}': #{e.}" end |