Class: Fontist::Import::Files::CollectionFile
- Inherits:
-
Object
- Object
- Fontist::Import::Files::CollectionFile
- Defined in:
- lib/fontist/import/files/collection_file.rb
Instance Attribute Summary collapse
-
#fonts ⇒ Object
readonly
Returns the value of attribute fonts.
Class Method Summary collapse
Instance Method Summary collapse
- #filename ⇒ Object
-
#initialize(fontisan_collection, path, name_prefix = nil) ⇒ CollectionFile
constructor
A new instance of CollectionFile.
- #source_filename ⇒ Object
Constructor Details
#initialize(fontisan_collection, path, name_prefix = nil) ⇒ CollectionFile
Returns a new instance of CollectionFile.
39 40 41 42 43 44 |
# File 'lib/fontist/import/files/collection_file.rb', line 39 def initialize(fontisan_collection, path, name_prefix = nil) @collection = fontisan_collection @path = path @name_prefix = name_prefix @fonts = extract_fonts end |
Instance Attribute Details
#fonts ⇒ Object (readonly)
Returns the value of attribute fonts.
37 38 39 |
# File 'lib/fontist/import/files/collection_file.rb', line 37 def fonts @fonts end |
Class Method Details
.from_path(path, name_prefix: nil, error_collector: nil) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/fontist/import/files/collection_file.rb', line 8 def from_path(path, name_prefix: nil, error_collector: nil) collection = build_collection(path, error_collector: error_collector) return nil unless collection new(collection, path, name_prefix) rescue StandardError => e # rubocop:disable Layout/LineLength Fontist.ui.debug("Failed to build collection from #{File.basename(path)}: #{e.}") # rubocop:enable Layout/LineLength nil end |
Instance Method Details
#filename ⇒ Object
46 47 48 49 50 51 |
# File 'lib/fontist/import/files/collection_file.rb', line 46 def filename # rubocop:disable Layout/LineLength # Use the exact filename from the archive - do NOT modify or standardize it # rubocop:enable Layout/LineLength File.basename(@path) end |
#source_filename ⇒ Object
53 54 55 56 57 |
# File 'lib/fontist/import/files/collection_file.rb', line 53 def source_filename # source_filename is only used when filename != original filename # Since we now use exact filename, this should always be nil nil end |