Class: Pubid::Cie::SingleIdentifier
- Inherits:
-
Identifier
- Object
- Lutaml::Model::Serializable
- Identifier
- Identifier
- Pubid::Cie::SingleIdentifier
- Defined in:
- lib/pubid/cie/single_identifier.rb
Overview
Base class for single CIE identifiers (standards, conferences, etc.) Single Responsibility: Provide common attributes for base documents
Single identifiers are base documents that can exist independently, as opposed to supplement identifiers (amendments, corrigenda) which modify a base identifier.
Classes inheriting from SingleIdentifier:
- Standard (common CIE publications)
- Conference (conference proceedings)
- Bundle (bundles of multiple identifiers)
- JointPublished (co-published with ISO/IEC)
- DualPublished (dual published with IEC)
- Identical (identical to ISO publications)
- TutorialBundle (tutorial bundles)
Direct Known Subclasses
Identifiers::Bundle, Identifiers::Conference, Identifiers::DualPublished, Identifiers::Identical, Identifiers::JointPublished, Identifiers::Proceedings, Identifiers::Standard, Identifiers::TutorialBundle
Instance Method Summary collapse
-
#date_sep_char ⇒ Object
The number<->year separator character, derived from
style(the sole separator field; there is no date_separator attribute): current -> ":" legacy -> "-" slash -> "/". -
#exclude(*args) ⇒ Object
Partial-reference matching: CIE keeps the publication year in its own
yearstring attribute (the separator lives instyle), not aDatecomponent, so the base's:year->:dateremap would nil the unused inheriteddateand leaveyearintact. - #mr_languages ⇒ Object
-
#mr_year ⇒ Object
CIE stores its publication year in its own
yearstring attribute (not a Components::Date), and uses a single-Language component with multiple formats.
Methods inherited from Identifier
Methods inherited from Identifier
apply_mappings, #base, #base_document, concrete_class_for, #dated_version_of?, #draft_of?, #drop_supplements, #edition_of?, #eql?, from_hash, #has_supplement?, #hash, #includes?, #initialize, #matches?, #mr_all_parts, #mr_edition, #mr_number, #mr_number_with_part, #mr_part, #mr_publisher, #mr_subpart, #mr_supplement_suffix, #mr_type, #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_s, #to_slug, #to_supplement_s, #to_urn, #urn_supplement_type, #urn_type_code, #year
Constructor Details
This class inherits a constructor from Pubid::Identifier
Instance Method Details
#date_sep_char ⇒ Object
The number<->year separator character, derived from style (the sole
separator field; there is no date_separator attribute):
current -> ":" legacy -> "-" slash -> "/"
30 31 32 |
# File 'lib/pubid/cie/single_identifier.rb', line 30 def date_sep_char { "legacy" => "-", "slash" => "/" }.fetch(style, ":") end |
#exclude(*args) ⇒ Object
Partial-reference matching: CIE keeps the publication year in its own
year string attribute (the separator lives in style), not a Date
component, so the base's :year->:date remap would nil the unused
inherited date and leave year intact. Call super (preserving the
nested-identifier recursion), then nil year directly so a year-less
CIE ref is a year wildcard under matches?(ignore: [:year]).
Known limit: style (which also encodes the era: current<->colon,
legacy<->dash) is intentionally NOT wildcarded, so bare CIE 015
(always current) matches a colon-dated full but not a legacy dash-dated
(pre-2001) one. Partial-ref scope targets modern colon forms.
45 46 47 48 49 |
# File 'lib/pubid/cie/single_identifier.rb', line 45 def exclude(*args) result = super result.year = nil if args.include?(:year) || args.include?(:date) result end |
#mr_languages ⇒ Object
61 62 63 64 65 66 |
# File 'lib/pubid/cie/single_identifier.rb', line 61 def mr_languages return nil unless respond_to?(:language) && language # Lowercase + filename-safe: drop the leading `/` (path-unsafe). language.code.to_s.downcase end |
#mr_year ⇒ Object
CIE stores its publication year in its own year string attribute
(not a Components::Date), and uses a single-Language component with
multiple formats. Override the lossless MR template so CIE S 017/E:2011
round-trips as CIE.S.017.E.2011 rather than losing the type letter,
language, and year (issue #142). Subclasses add the s_prefix and
language attributes that this template reads.
57 58 59 |
# File 'lib/pubid/cie/single_identifier.rb', line 57 def mr_year year&.to_s end |