Class: Fontisan::Commands::LsCommand
- Inherits:
-
Object
- Object
- Fontisan::Commands::LsCommand
- Defined in:
- lib/fontisan/commands/ls_command.rb
Overview
Command to list contents of font files (collections or individual fonts).
This command provides a universal “ls” interface that auto-detects whether the input is a collection (TTC/OTC) or individual font (TTF/OTF) and returns the appropriate listing:
-
For collections: Lists all fonts in the collection
-
For individual fonts: Shows a quick summary
Instance Method Summary collapse
-
#initialize(file_path, options = {}) ⇒ LsCommand
constructor
Initialize ls command.
-
#run ⇒ CollectionListInfo, FontSummary
Execute the ls command.
Constructor Details
#initialize(file_path, options = {}) ⇒ LsCommand
Initialize ls command
34 35 36 37 |
# File 'lib/fontisan/commands/ls_command.rb', line 34 def initialize(file_path, = {}) @file_path = file_path @options = end |
Instance Method Details
#run ⇒ CollectionListInfo, FontSummary
Execute the ls command
Auto-detects file type and returns appropriate model:
-
CollectionListInfo for TTC/OTC files
-
FontSummary for TTF/OTF files
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/fontisan/commands/ls_command.rb', line 48 def run if FontLoader.collection?(@file_path) list_collection else font_summary end rescue Errno::ENOENT raise rescue StandardError => e raise Error, "Failed to list file contents: #{e.}" end |