Class: Glossarist::V3::BibliographyFile

Inherits:
Lutaml::Model::Collection
  • Object
show all
Defined in:
lib/glossarist/v3/bibliography_file.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_file(path) ⇒ Object



12
13
14
15
16
# File 'lib/glossarist/v3/bibliography_file.rb', line 12

def self.from_file(path)
  return nil unless File.exist?(path)

  from_yaml(File.read(path))
end

Instance Method Details

#[](key) ⇒ Object



22
23
24
# File 'lib/glossarist/v3/bibliography_file.rb', line 22

def [](key)
  entries.find { |e| e.id == key.to_s }
end

#resolve?(anchor) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/glossarist/v3/bibliography_file.rb', line 18

def resolve?(anchor)
  entries.any? { |e| e.id == anchor.to_s }
end