Class: Glossarist::Validation::BibliographyIndex
- Inherits:
-
Object
- Object
- Glossarist::Validation::BibliographyIndex
- Defined in:
- lib/glossarist/validation/bibliography_index.rb
Instance Attribute Summary collapse
-
#entries ⇒ Object
readonly
Returns the value of attribute entries.
Class Method Summary collapse
Instance Method Summary collapse
- #anchors ⇒ Object
- #each_entry(&block) ⇒ Object
-
#initialize ⇒ BibliographyIndex
constructor
A new instance of BibliographyIndex.
- #register(anchor, source = nil) ⇒ Object
- #resolve?(anchor) ⇒ Boolean
Constructor Details
#initialize ⇒ BibliographyIndex
Returns a new instance of BibliographyIndex.
11 12 13 |
# File 'lib/glossarist/validation/bibliography_index.rb', line 11 def initialize @entries = {} end |
Instance Attribute Details
#entries ⇒ Object (readonly)
Returns the value of attribute entries.
9 10 11 |
# File 'lib/glossarist/validation/bibliography_index.rb', line 9 def entries @entries end |
Class Method Details
.build_from_concepts(concepts, dataset_path: nil, bibliography_yaml: nil) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/glossarist/validation/bibliography_index.rb', line 31 def self.build_from_concepts(concepts, dataset_path: nil, bibliography_yaml: nil) index = new concepts.each { |concept| index_concept_sources(index, concept) } yaml = bibliography_yaml || read_bibliography_file(dataset_path) index_bibliography_yaml(index, yaml) if yaml index end |
Instance Method Details
#anchors ⇒ Object
23 24 25 |
# File 'lib/glossarist/validation/bibliography_index.rb', line 23 def anchors @entries.keys end |
#each_entry(&block) ⇒ Object
27 28 29 |
# File 'lib/glossarist/validation/bibliography_index.rb', line 27 def each_entry(&block) @entries.each_value(&block) end |
#register(anchor, source = nil) ⇒ Object
15 16 17 |
# File 'lib/glossarist/validation/bibliography_index.rb', line 15 def register(anchor, source = nil) @entries[normalize_anchor(anchor)] = { anchor: anchor, source: source } end |
#resolve?(anchor) ⇒ Boolean
19 20 21 |
# File 'lib/glossarist/validation/bibliography_index.rb', line 19 def resolve?(anchor) @entries.key?(normalize_anchor(anchor)) end |