Class: Fontisan::Models::FontExport
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Fontisan::Models::FontExport
- Defined in:
- lib/fontisan/models/font_export.rb
Overview
FontExport represents complete font structure for export to YAML/JSON
This model encapsulates the entire font structure including header information, all tables (parsed and binary), and metadata. It supports round-trip conversion: font → export → import → font.
Defined Under Namespace
Classes: Header, Metadata, TableExport
Instance Method Summary collapse
-
#add_table(tag:, checksum:, parsed: false, data: nil, fields: nil) ⇒ void
Add a table to the export.
-
#binary_tables ⇒ Array<TableExport>
Get all binary-only tables.
-
#find_table(tag) ⇒ TableExport?
Find a table by tag.
-
#parsed_tables ⇒ Array<TableExport>
Get all parsed tables.
-
#valid? ⇒ Boolean
Validate export structure.
Instance Method Details
#add_table(tag:, checksum:, parsed: false, data: nil, fields: nil) ⇒ void
This method returns an undefined value.
Add a table to the export
140 141 142 143 144 145 146 147 148 |
# File 'lib/fontisan/models/font_export.rb', line 140 def add_table(tag:, checksum:, parsed: false, data: nil, fields: nil) tables << TableExport.new( tag: tag, checksum: checksum, parsed: parsed, data: data, fields: fields, ) end |
#binary_tables ⇒ Array<TableExport>
Get all binary-only tables
128 129 130 |
# File 'lib/fontisan/models/font_export.rb', line 128 def binary_tables tables.reject(&:parsed) end |
#find_table(tag) ⇒ TableExport?
Find a table by tag
114 115 116 |
# File 'lib/fontisan/models/font_export.rb', line 114 def find_table(tag) tables.find { |t| t.tag == tag } end |
#parsed_tables ⇒ Array<TableExport>
Get all parsed tables
121 122 123 |
# File 'lib/fontisan/models/font_export.rb', line 121 def parsed_tables tables.select(&:parsed) end |
#valid? ⇒ Boolean
Validate export structure
153 154 155 |
# File 'lib/fontisan/models/font_export.rb', line 153 def valid? !.nil? && !header.nil? && !tables.empty? end |