Class: Fontist::Index
- Inherits:
-
Lutaml::Model::Collection
- Object
- Lutaml::Model::Collection
- Fontist::Index
- Defined in:
- lib/fontist/index.rb
Class Method Summary collapse
- .from_file(path) ⇒ Object
- .rebuild ⇒ Object
-
.reset_cache ⇒ Object
TODO: Uncomment all lines when each fixed.
Instance Method Summary collapse
Class Method Details
.from_file(path) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/fontist/index.rb', line 33 def self.from_file(path) return new unless File.exist?(path) content = File.read(path) from_yaml(content) end |
.rebuild ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/fontist/index.rb', line 44 def self.rebuild Fontist::Indexes::DefaultFamilyFontIndex.rebuild.to_file Fontist::Indexes::PreferredFamilyFontIndex.rebuild.to_file Fontist::Indexes::FilenameIndex.rebuild.to_file reset_cache end |
.reset_cache ⇒ Object
TODO: Uncomment all lines when each fixed
53 54 55 56 57 |
# File 'lib/fontist/index.rb', line 53 def self.reset_cache # Fontist::Indexes::DefaultFamilyFontIndex.reset_cache # Fontist::Indexes::PreferredFamilyFontIndex.reset_cache # Fontist::Indexes::FilenameIndex.reset_cache end |
Instance Method Details
#to_file(path) ⇒ Object
40 41 42 |
# File 'lib/fontist/index.rb', line 40 def to_file(path) File.write(path, to_yaml) end |