Class: Fontist::Indexes::PreferredFamilyFontIndex

Inherits:
BaseIndex
  • Object
show all
Defined in:
lib/fontist/indexes/preferred_family_font_index.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseIndex

#add_index_formula, #build, from_yaml, #initialize, #load_formulas, #load_index_formulas, rebuild, reset_cache, #to_h, #to_yaml

Constructor Details

This class inherits a constructor from Fontist::Indexes::BaseIndex

Class Method Details

.pathObject



6
7
8
# File 'lib/fontist/indexes/preferred_family_font_index.rb', line 6

def self.path
  Fontist.formula_preferred_family_index_path
end

Instance Method Details

#add_formula(formula) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/fontist/indexes/preferred_family_font_index.rb', line 10

def add_formula(formula)
  formula.fonts.each do |font|
    font.styles.each do |style|
      font_name = style.preferred_family_name || font.name
      add_index_formula(font_name, formula.to_index_formula)
    end
  end
end

#normalize_key(key) ⇒ Object



19
20
21
# File 'lib/fontist/indexes/preferred_family_font_index.rb', line 19

def normalize_key(key)
  key.downcase
end