Class: Pubid::Ietf::Identifier
- Inherits:
-
Pubid::Identifier
- Object
- Lutaml::Model::Serializable
- Pubid::Identifier
- Pubid::Ietf::Identifier
- Defined in:
- lib/pubid/ietf/identifiers/base.rb
Overview
Base class for every IETF identifier AND the flavor's parse/create entry point (mirrors Pubid::Jis::Identifier). Concrete identifiers under Pubid::Ietf::Identifiers descend from this class, so a parsed IETF id is an instance of Pubid::Ietf::Identifier.
All families are flat, supplement-free, and use plain string attributes:
* Rfc -> number ("2119")
* Bcp/Std/Fyi -> series ("BCP"/"STD"/"FYI") + number ("3")
* InternetDraft -> name ("draft-giuliano-treedn") + optional version
Direct Known Subclasses
Constant Summary collapse
- IETF_TYPE_MAP =
Polymorphic type map for lutaml::Model key_value (de)serialization: maps each subclass's polymorphic_name to its class name so a stored hash rebuilds the correct identifier type via the shared from_hash dispatch.
{ "pubid:ietf:rfc" => "Pubid::Ietf::Identifiers::Rfc", "pubid:ietf:bcp" => "Pubid::Ietf::Identifiers::Bcp", "pubid:ietf:std" => "Pubid::Ietf::Identifiers::Std", "pubid:ietf:fyi" => "Pubid::Ietf::Identifiers::Fyi", "pubid:ietf:internet-draft" => "Pubid::Ietf::Identifiers::InternetDraft", }.freeze
- PUBLISHER =
Publisher is always "IETF". A plain constant (not a
publishermethod) so it doesn't shadow the inherited lutamlpublisherattribute, which would otherwise fail serialization type validation. "IETF"
Class Method Summary collapse
-
.parse(identifier) ⇒ Identifier
Parse an IETF identifier string into the appropriate identifier object.
Instance Method Summary collapse
-
#to_s(**opts) ⇒ Object
Basic string representation.
Methods inherited from Pubid::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) ⇒ Identifier
Parse an IETF identifier string into the appropriate identifier object.
66 67 68 69 70 71 |
# File 'lib/pubid/ietf/identifiers/base.rb', line 66 def self.parse(identifier) parsed = Parser.parse(identifier) Builder.build(parsed) rescue Parslet::ParseFailed => e raise "Failed to parse IETF identifier '#{identifier}': #{e.}" end |
Instance Method Details
#to_s(**opts) ⇒ Object
Basic string representation. Delegates to the flavor renderer.
55 56 57 |
# File 'lib/pubid/ietf/identifiers/base.rb', line 55 def to_s(**opts) render(format: :human, **opts) end |