Class: Coradoc::CoreModel::BibliographyEntry
- Inherits:
-
Base
- Object
- Lutaml::Model::Serializable
- Base
- Coradoc::CoreModel::BibliographyEntry
- Defined in:
- lib/coradoc/core_model/bibliography_entry.rb
Overview
Individual bibliography entry (reference).
Bibliography entries represent single references within a bibliography, with anchor names for citation linking.
Instance Attribute Summary collapse
-
#anchor_name ⇒ String?
readonly
The anchor name for citing this entry (e.g., “ISO712”).
-
#document_id ⇒ String?
readonly
The document identifier (e.g., “ISO 712”).
-
#ref_text ⇒ String?
readonly
The reference text/citation description.
-
#url ⇒ String?
readonly
Optional URL for the reference.
Attributes inherited from Base
#element_attributes, #id, #metadata_entries, #title
Instance Method Summary collapse
-
#display_text ⇒ String
Returns a formatted display string combining label and reference text.
Methods inherited from Base
#accept, #attr, #metadata, #semantically_equivalent?, #set_attr, #set_metadata
Instance Attribute Details
#anchor_name ⇒ String? (readonly)
Returns The anchor name for citing this entry (e.g., “ISO712”).
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/coradoc/core_model/bibliography_entry.rb', line 29 class BibliographyEntry < Base attribute :anchor_name, :string attribute :document_id, :string attribute :ref_text, :string attribute :url, :string # Returns a formatted display string combining label and reference text. # # Uses document_id or anchor_name as the label, falling back to ref_text # alone when no label is available. # # @return [String] formatted citation text def display_text label = document_id || anchor_name || '' ref = ref_text || '' label.empty? ? ref : "#{label}: #{ref}" end end |
#document_id ⇒ String? (readonly)
Returns The document identifier (e.g., “ISO 712”).
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/coradoc/core_model/bibliography_entry.rb', line 29 class BibliographyEntry < Base attribute :anchor_name, :string attribute :document_id, :string attribute :ref_text, :string attribute :url, :string # Returns a formatted display string combining label and reference text. # # Uses document_id or anchor_name as the label, falling back to ref_text # alone when no label is available. # # @return [String] formatted citation text def display_text label = document_id || anchor_name || '' ref = ref_text || '' label.empty? ? ref : "#{label}: #{ref}" end end |
#ref_text ⇒ String? (readonly)
Returns The reference text/citation description.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/coradoc/core_model/bibliography_entry.rb', line 29 class BibliographyEntry < Base attribute :anchor_name, :string attribute :document_id, :string attribute :ref_text, :string attribute :url, :string # Returns a formatted display string combining label and reference text. # # Uses document_id or anchor_name as the label, falling back to ref_text # alone when no label is available. # # @return [String] formatted citation text def display_text label = document_id || anchor_name || '' ref = ref_text || '' label.empty? ? ref : "#{label}: #{ref}" end end |
#url ⇒ String? (readonly)
Returns Optional URL for the reference.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/coradoc/core_model/bibliography_entry.rb', line 29 class BibliographyEntry < Base attribute :anchor_name, :string attribute :document_id, :string attribute :ref_text, :string attribute :url, :string # Returns a formatted display string combining label and reference text. # # Uses document_id or anchor_name as the label, falling back to ref_text # alone when no label is available. # # @return [String] formatted citation text def display_text label = document_id || anchor_name || '' ref = ref_text || '' label.empty? ? ref : "#{label}: #{ref}" end end |
Instance Method Details
#display_text ⇒ String
Returns a formatted display string combining label and reference text.
Uses document_id or anchor_name as the label, falling back to ref_text alone when no label is available.
41 42 43 44 45 |
# File 'lib/coradoc/core_model/bibliography_entry.rb', line 41 def display_text label = document_id || anchor_name || '' ref = ref_text || '' label.empty? ? ref : "#{label}: #{ref}" end |