Module: Fontist::Indexes::IndexMixin::ClassMethods
- Defined in:
- lib/fontist/indexes/index_mixin.rb
Instance Method Summary collapse
- #from_file(file_path = path) ⇒ Object
- #rebuild ⇒ Object
- #rebuild_with_formulas(formulas) ⇒ Object
- #reset_cache ⇒ Object
Instance Method Details
#from_file(file_path = path) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/fontist/indexes/index_mixin.rb', line 43 def from_file(file_path = path) Fontist.ui.debug("Index: #{file_path}") Fontist.formulas_repo_path_exists! rebuild unless File.exist?(file_path) file_content = File.read(file_path).strip if file_content.empty? || file_content == "---" # Return empty collection for empty index files return new end from_yaml(file_content) end |
#rebuild ⇒ Object
60 61 62 63 |
# File 'lib/fontist/indexes/index_mixin.rb', line 60 def rebuild # puts "Rebuilding index..." new.build end |
#rebuild_with_formulas(formulas) ⇒ Object
65 66 67 |
# File 'lib/fontist/indexes/index_mixin.rb', line 65 def rebuild_with_formulas(formulas) new.build_with_formulas(formulas) end |
#reset_cache ⇒ Object
69 70 71 72 73 |
# File 'lib/fontist/indexes/index_mixin.rb', line 69 def reset_cache # Delete the index file to force rebuild on next access # This is important for tests to ensure clean state FileUtils.rm_f(path) end |