class Fontist::Import::OtfinfoGenerate
Constants
- TEMPLATE_PATH
Public Class Methods
new(font)
click to toggle source
# File lib/fontist/import/otfinfo_generate.rb, line 12 def initialize(font) @font = font end
Public Instance Methods
call()
click to toggle source
# File lib/fontist/import/otfinfo_generate.rb, line 16 def call paths = font_paths(@font) puts paths styles = generate_styles(paths) puts render(styles) end
Private Instance Methods
font_paths(font)
click to toggle source
# File lib/fontist/import/otfinfo_generate.rb, line 25 def font_paths(font) formula = Fontist::Formula.find(font) font_formula = Object.const_get(formula.installer) font_formula.install(confirmation: "yes") end
generate_styles(paths)
click to toggle source
# File lib/fontist/import/otfinfo_generate.rb, line 31 def generate_styles(paths) paths.map do |path| info = OtfParser.new(path).call OtfStyle.new(info, path).call end end
render(styles)
click to toggle source
# File lib/fontist/import/otfinfo_generate.rb, line 38 def render(styles) template = File.read(TEMPLATE_PATH) renderer = ERB.new(template, trim_mode: "-") renderer.result(Fontist::Import::TemplateHelper.bind(styles)) end