Class: Fontist::Import::Files::CollectionFile

Inherits:
Object
  • Object
show all
Defined in:
lib/fontist/import/files/collection_file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, name_prefix: nil) ⇒ CollectionFile

Returns a new instance of CollectionFile.



11
12
13
14
15
16
# File 'lib/fontist/import/files/collection_file.rb', line 11

def initialize(path, name_prefix: nil)
  @path = path
  @name_prefix = name_prefix
  @fonts = read
  @extension = detect_extension
end

Instance Attribute Details

#fontsObject (readonly)

Returns the value of attribute fonts.



9
10
11
# File 'lib/fontist/import/files/collection_file.rb', line 9

def fonts
  @fonts
end

Instance Method Details

#filenameObject



18
19
20
# File 'lib/fontist/import/files/collection_file.rb', line 18

def filename
  File.basename(@path, ".*") + "." + @extension
end

#source_filenameObject



22
23
24
# File 'lib/fontist/import/files/collection_file.rb', line 22

def source_filename
  File.basename(@path) unless filename == File.basename(@path)
end