Class: Pubid::Csa::CompositeIdentifier
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Pubid::Csa::CompositeIdentifier
- Defined in:
- lib/pubid/csa/composite_identifier.rb
Overview
CompositeIdentifier is the base class for identifiers that contain collections of other identifiers or package materials.
Examples:
- PackageIdentifier: Base + package materials
- Future: BundleIdentifier refactor to use composite
This follows the Composite pattern where an identifier can contain other identifiers or additional metadata as a collection.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#base ⇒ Object
The primary/base identifier Use attr_accessor since it can be any identifier object.
Instance Method Summary collapse
-
#root ⇒ Object
CSA composites are not Pubid::Identifier objects, so they do not inherit #root.
-
#to_mr_string ⇒ Object
CSA composites serialise through
to_s, so MR mirrors that with→.,:→.,/→-, then lowercased (issue #142). -
#to_s ⇒ Object
Subclasses MUST implement to_s to define how they render.
- #to_slug ⇒ Object
Instance Attribute Details
#base ⇒ Object
The primary/base identifier Use attr_accessor since it can be any identifier object
19 20 21 |
# File 'lib/pubid/csa/composite_identifier.rb', line 19 def base @base end |
Instance Method Details
#root ⇒ Object
CSA composites are not Pubid::Identifier objects, so they do not inherit #root. They are their own origin for matching purposes.
38 39 40 |
# File 'lib/pubid/csa/composite_identifier.rb', line 38 def root self end |
#to_mr_string ⇒ Object
CSA composites serialise through to_s, so MR mirrors that with
→ ., : → ., / → -, then lowercased (issue #142).
28 29 30 |
# File 'lib/pubid/csa/composite_identifier.rb', line 28 def to_mr_string to_s.tr(" ", ".").tr(":", ".").tr("/", "-").downcase end |
#to_s ⇒ Object
Subclasses MUST implement to_s to define how they render
22 23 24 |
# File 'lib/pubid/csa/composite_identifier.rb', line 22 def to_s raise NotImplementedError, "Subclasses must implement to_s method" end |
#to_slug ⇒ Object
32 33 34 |
# File 'lib/pubid/csa/composite_identifier.rb', line 32 def to_slug to_mr_string end |