Class: Fontisan::Formatters::TextFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/fontisan/formatters/text_formatter.rb

Overview

TextFormatter formats model objects into human-readable text output.

This formatter handles Models::FontInfo and Models::TableInfo objects, presenting them with proper alignment and spacing for terminal display.

Examples:

Format font information

formatter = TextFormatter.new
text = formatter.format(font_info)
puts text

Instance Method Summary collapse

Instance Method Details

#format(model) ⇒ String

Format a model object into human-readable text.

Parameters:

  • model (Object)

    The model to format (FontInfo, TableInfo, etc.)

Returns:

  • (String)

    Formatted text representation



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/fontisan/formatters/text_formatter.rb', line 19

def format(model)
  case model
  when Models::FontInfo
    format_font_info(model)
  when Models::TableInfo
    format_table_info(model)
  when Models::GlyphInfo
    format_glyph_info(model)
  when Models::UnicodeMappings
    format_unicode_mappings(model)
  when Models::VariableFontInfo
    format_variable_font_info(model)
  when Models::OpticalSizeInfo
    format_optical_size_info(model)
  when Models::ScriptsInfo
    format_scripts_info(model)
  when Models::AllScriptsFeaturesInfo
    format_all_scripts_features_info(model)
  when Models::FeaturesInfo
    format_features_info(model)
  else
    model.to_s
  end
end