Class: Glossarist::V3::ImageFile

Inherits:
Lutaml::Model::Collection
  • Object
show all
Defined in:
lib/glossarist/v3/image_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/image_file.rb', line 12

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

  from_yaml(File.read(path))
end

Instance Method Details

#anchor_for_path(path) ⇒ Object



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

def anchor_for_path(path)
  entries.find { |e| e.path == path }&.id
end

#path?(path) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/glossarist/v3/image_file.rb', line 26

def path?(path)
  entries.any? { |e| e.path == path }
end

#path_for_anchor(anchor) ⇒ Object



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

def path_for_anchor(anchor)
  entries.find { |e| e.id == anchor.to_s }&.path
end