Class: Fontist::Import::OtfParser
- Inherits:
-
Object
- Object
- Fontist::Import::OtfParser
- Defined in:
- lib/fontist/import/otf_parser.rb
Constant Summary collapse
- REQUIREMENTS =
{ otfinfo: Fontist::Import::Otfinfo::OtfinfoRequirement.new, }.freeze
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(path) ⇒ OtfParser
constructor
A new instance of OtfParser.
Constructor Details
#initialize(path) ⇒ OtfParser
Returns a new instance of OtfParser.
11 12 13 |
# File 'lib/fontist/import/otf_parser.rb', line 11 def initialize(path) @path = path end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# 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 |