Class: Pubid::Omg::Identifier
- Inherits:
-
Identifier
- Object
- Lutaml::Model::Serializable
- Identifier
- Pubid::Omg::Identifier
- Defined in:
- lib/pubid/omg/identifier.rb
Overview
Base class for every OMG identifier AND the flavor's parse/create entry point.
Direct Known Subclasses
Constant Summary collapse
- OMG_TYPE_MAP =
{ "pubid:omg:specification" => "Pubid::Omg::Identifiers::Specification", }.freeze
- PUBLISHER =
"OMG"
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Identifier
apply_mappings, #base, #base_document, concrete_class_for, #dated_version_of?, #draft_of?, #drop_supplements, #edition_of?, #eql?, #exclude, from_hash, #has_supplement?, #hash, #includes?, #initialize, #matches?, #mr_all_parts, #mr_edition, #mr_languages, #mr_number, #mr_number_with_part, #mr_part, #mr_publisher, #mr_subpart, #mr_supplement_suffix, #mr_type, #mr_year, #new_edition_of?, polymorphic_name, polymorphic_type_map, #related_to?, #render, #resolve_urn_generator, #root, #sibling_of?, #supplement_of?, #to_hash, #to_mr_string, #to_slug, #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
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/pubid/omg/identifier.rb', line 32 def self.parse(identifier) if identifier.length > Pubid::MAX_INPUT_LENGTH raise ArgumentError, Pubid::INPUT_TOO_LONG_MESSAGE end parsed = Parser.parse(identifier) Builder.build(parsed) rescue Parslet::ParseFailed => e raise "Failed to parse OMG identifier '#{identifier}': #{e.}" end |
Instance Method Details
#to_s(**opts) ⇒ Object
28 29 30 |
# File 'lib/pubid/omg/identifier.rb', line 28 def to_s(**opts) render(format: :human, **opts) end |