Class: Fontist::FontPath
- Inherits:
-
Object
- Object
- Fontist::FontPath
- Defined in:
- lib/fontist/font_path.rb
Instance Method Summary collapse
- #fontist_font? ⇒ Boolean
- #formulas ⇒ Object
-
#initialize(path) ⇒ FontPath
constructor
A new instance of FontPath.
- #to_s ⇒ Object
Constructor Details
#initialize(path) ⇒ FontPath
Returns a new instance of FontPath.
5 6 7 |
# File 'lib/fontist/font_path.rb', line 5 def initialize(path) @path = path end |
Instance Method Details
#fontist_font? ⇒ Boolean
25 26 27 |
# File 'lib/fontist/font_path.rb', line 25 def fontist_font? @path.start_with?(Fontist.fonts_path.to_s) end |
#formulas ⇒ Object
17 18 19 20 21 22 23 |
# 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 ⇒ Object
9 10 11 12 13 14 15 |
# 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 |