Module: Pubid::Iso

Defined in:
lib/pubid/iso.rb,
lib/pubid/iso/parser.rb,
lib/pubid/iso/scheme.rb,
lib/pubid/iso/builder.rb,
lib/pubid/iso/utilities.rb,
lib/pubid/iso/components.rb,
lib/pubid/iso/identifier.rb,
lib/pubid/iso/urn_parser.rb,
lib/pubid/iso/identifiers.rb,
lib/pubid/iso/urn_generator.rb,
lib/pubid/iso/components/code.rb,
lib/pubid/iso/format_resolver.rb,
lib/pubid/iso/identifiers/pas.rb,
lib/pubid/iso/rendering_style.rb,
lib/pubid/iso/identifiers/base.rb,
lib/pubid/iso/identifiers/data.rb,
lib/pubid/iso/identifiers/guide.rb,
lib/pubid/iso/single_identifier.rb,
lib/pubid/iso/bundled_identifier.rb,
lib/pubid/iso/combined_identifier.rb,
lib/pubid/iso/identifiers/extract.rb,
lib/pubid/iso/components/publisher.rb,
lib/pubid/iso/identifiers/addendum.rb,
lib/pubid/iso/identifiers/amendment.rb,
lib/pubid/iso/supplement_identifier.rb,
lib/pubid/iso/identifiers/directives.rb,
lib/pubid/iso/identifiers/supplement.rb,
lib/pubid/iso/identifiers/corrigendum.rb,
lib/pubid/iso/identifiers/tc_document.rb,
lib/pubid/iso/identifiers/recommendation.rb,
lib/pubid/iso/identifiers/technical_report.rb,
lib/pubid/iso/identifiers/directives_supplement.rb,
lib/pubid/iso/identifiers/international_standard.rb,
lib/pubid/iso/identifiers/technical_specification.rb,
lib/pubid/iso/identifiers/technology_trends_assessments.rb,
lib/pubid/iso/identifiers/international_workshop_agreement.rb,
lib/pubid/iso/identifiers/international_standardized_profile.rb

Defined Under Namespace

Modules: Components, Identifiers, Utilities Classes: Builder, BundledIdentifier, CombinedIdentifier, FormatResolver, Identifier, Parser, RefDated, RefDatedLong, RefNumLong, RefNumShort, RefUndated, RefUndatedLong, RenderingStyle, Scheme, SingleIdentifier, SupplementIdentifier, UrnGenerator, UrnParser

Class Method Summary collapse

Class Method Details

.parse(identifier, format: :auto) ⇒ Identifier

Parse an ISO identifier string

Parameters:

  • identifier (String)

    the identifier string to parse

  • format (Symbol) (defaults to: :auto)

    :auto, :human, :mr_string, or :urn

Returns:



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/pubid/iso.rb', line 27

def self.parse(identifier, format: :auto)
  format = Pubid::FormatDetector.detect(identifier) if format == :auto

  case format
  when :urn
    UrnParser.parse(identifier)
  when :mr_string
    Pubid::Parsers::MrString.parse(identifier)
  else
    Scheme.parse(identifier)
  end
end

.parse_urn(urn) ⇒ Identifier

Parse an ISO URN string

Parameters:

  • urn (String)

    the URN string to parse

Returns:

Raises:

  • (Errors::ParseError)

    if URN is invalid



44
45
46
# File 'lib/pubid/iso.rb', line 44

def self.parse_urn(urn)
  UrnParser.parse(urn)
end