class Fontist::FontPath

Public Class Methods

new(path) click to toggle source
# File lib/fontist/font_path.rb, line 5
def initialize(path)
  @path = path
end

Public Instance Methods

fontist_font?() click to toggle source
# File lib/fontist/font_path.rb, line 25
def fontist_font?
  @path.start_with?(Fontist.fonts_path.to_s)
end
formulas() click to toggle source
# File lib/fontist/font_path.rb, line 17
def formulas
  @formulas ||= if fontist_font?
                  Indexes::FilenameIndex.from_yaml.load_index_formulas(File.basename(@path)).map(&:name)
                else
                  []
                end
end
to_s() click to toggle source
# File lib/fontist/font_path.rb, line 9
def to_s
  [].tap do |s|
    s << "-"
    s << @path
    s << "(from #{formulas.join(' or ')} formula)" if formulas.any?
  end.join(" ")
end