class Fontist::Import::OtfParser

Constants

REQUIREMENTS

Public Class Methods

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

Public Instance Methods

call() click to toggle source
# File lib/fontist/import/otf_parser.rb, line 15
def call
  raise ArgumentError, "Empty path" unless @path

  text = REQUIREMENTS[:otfinfo].call(@path)
  text.split("\n")
    .select { |x| x.include?(":") }
    .map { |x| x.split(":", 2) }
    .map { |x| x.map { |y| Fontist::Import::TextHelper.cleanup(y) } }
    .to_h
end