Class: Pubid::Ansi::Identifier
- Inherits:
-
Identifier
- Object
- Lutaml::Model::Serializable
- Identifier
- Pubid::Ansi::Identifier
- Defined in:
- lib/pubid/ansi/identifier.rb
Overview
Base ANSI identifier class
Direct Known Subclasses
Class Method Summary collapse
-
.create(type: nil, **opts) ⇒ Object
Factory that builds an ANSI identifier from a hash of primitives.
- .parse(string) ⇒ Object
Methods inherited from 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, #year
Constructor Details
This class inherits a constructor from Pubid::Identifier
Class Method Details
.create(type: nil, **opts) ⇒ Object
Factory that builds an ANSI identifier from a hash of primitives.
Defaults to Pubid::Ansi::Identifiers::Standard (ANSI has Standard and AmericanNationalStandard, both sharing the same type key ‘:ans`).
ANSI quirk: the parser stores the publication year in the ‘part` attribute, not `date`. `.create` mirrors that — `:year` is coerced into `part` so the rendered output matches a parsed identifier.
20 21 22 23 |
# File 'lib/pubid/ansi/identifier.rb', line 20 def self.create(type: nil, **opts) klass = resolve_create_class(type) klass.new(**coerce_create_attrs(opts)) end |