Class: Pubid::Nist::Components::Edition
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Pubid::Nist::Components::Edition
- Defined in:
- lib/pubid/nist/components/edition.rb
Overview
Edition component for NIST publications per nist-pubid-spec.md Format: <edition-type><edition-id> Types: “-” (historical), “e” (edition), “r” (revision) Edition ID can be: number (“2”) OR year (“2021”) Additional text: Text AFTER “rev” prefix (WITHOUT “rev”)
SEMANTICS:
-
“e” or “edition” = edition (can be number or year or month+year)
-
“r” or “rev” or “revision” or “v” or “version” = revision (can be number or year or month+year)
-
If BOTH edition AND revision in same identifier:
-
Type is “e” (edition takes precedence)
-
ID is the edition value
-
additional_text is the revision part (WITHOUT “rev” prefix)
-
Renders with DOT separator: e2.June1908
-
Examples:
Edition.new(type: "e", id: "2").to_s # => "e2"
Edition.new(type: "e", id: "2", additional_text: "June1908").to_s # => "e2.June1908"
Edition.new(type: "e", id: "2", additional_text: "1908").to_s # => "e2.1908"
Edition.new(type: "r", id: "1963").to_s # => "r1963"
Edition.new(type: "r", id: "5").to_s # => "r5"
Edition.new(type: "r", id: "5", original_prefix: " Rev. ").to_s # => "Rev. 5"
Instance Method Summary collapse
-
#to_s(format = :short) ⇒ String
Render edition in specified format.
Instance Method Details
#to_s(format = :short) ⇒ String
Render edition in specified format
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/pubid/nist/components/edition.rb', line 39 def to_s(format = :short) case format when :short, :mr build_short_format when :long build_long_format when :abbrev build_short_format else build_short_format end end |