Class: Pubid::Iec::Identifier

Inherits:
Pubid::Identifier show all
Defined in:
lib/pubid/iec/identifier.rb

Class Method Summary collapse

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_s, #to_supplement_s, #to_urn, #urn_supplement_type, #urn_type_code

Constructor Details

This class inherits a constructor from Pubid::Identifier

Class Method Details

.parse(string) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/pubid/iec/identifier.rb', line 8

def self.parse(string)
  # Apply legacy update_codes normalization first, before any other preprocessing
  normalized = Core::UpdateCodes.apply(string, :iec)
  parsed = Pubid::Iec::Parser.new.parse(normalized)
  if parsed.nil? || parsed.empty?
    raise Pubid::Iec::Parser::ParseError,
          "Invalid identifier format"
  end

  Pubid::Iec::Builder.new(Pubid::Iec::Scheme).build(parsed)
end