Class: Fontist::Indexes::FormulaKeyToPath

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/fontist/indexes/formula_key_to_path.rb

Instance Method Summary collapse

Instance Method Details

#nameObject



17
18
19
# File 'lib/fontist/indexes/formula_key_to_path.rb', line 17

def name
  formula_path.map { |p| normalized(p) }
end

#normalized(path) ⇒ Object



21
22
23
24
25
26
# File 'lib/fontist/indexes/formula_key_to_path.rb', line 21

def normalized(path)
  return "" unless path

  escaped = Regexp.escape("#{Fontist.formulas_path}/")
  path.sub(Regexp.new("^#{escaped}"), "").sub(/\.yml$/, "").to_s
end

#to_fullObject



13
14
15
# File 'lib/fontist/indexes/formula_key_to_path.rb', line 13

def to_full
  formula_path.map { |p| Formula.from_file(full_path(p)) }
end