class Fontist::Import::Google::MetadataParser
Parser for Google Fonts METADATA.pb files
Parses protobuf text format files and provides OO access to metadata
Attributes
Public Class Methods
Source
# File lib/fontist/import/google/metadata_parser.rb, line 18 def initialize(file_path_or_content) @content = if File.exist?(file_path_or_content.to_s) File.read(file_path_or_content, encoding: "UTF-8") else file_path_or_content end parse end
Public Instance Methods
Source
# File lib/fontist/import/google/metadata_parser.rb, line 31 def filenames @font_files.map { |f| f[:filename] } end
Returns array of font filenames
@return [Array<String>] font filenames
Source
# File lib/fontist/import/google/metadata_parser.rb, line 38 def to_h { name: @name, designer: @designer, license: @license, category: @category, date_added: @date_added, font_files: @font_files, } end
Returns hash representation
@return [Hash] metadata hash