Class: Fontist::Info

Inherits:
Object
  • Object
show all
Defined in:
lib/fontist/repo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, path) ⇒ Info

Returns a new instance of Info.



7
8
9
10
11
# File 'lib/fontist/repo.rb', line 7

def initialize(name, path)
  @name = name
  @metadata = (path)
  @formulas = build_formulas(path)
end

Instance Attribute Details

#formulasObject (readonly)

Returns the value of attribute formulas.



5
6
7
# File 'lib/fontist/repo.rb', line 5

def formulas
  @formulas
end

#metadataObject (readonly)

Returns the value of attribute metadata.



5
6
7
# File 'lib/fontist/repo.rb', line 5

def 
  @metadata
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/fontist/repo.rb', line 5

def name
  @name
end

Instance Method Details

#to_sObject



13
14
15
16
17
18
19
20
# File 'lib/fontist/repo.rb', line 13

def to_s
  <<~MSG.chomp
    Repository info for '#{@name}':
    #{@metadata.map { |k, v| "  #{k}: #{v}" }.join("\n")}
    Found #{formulas.count} formulas:
    #{@formulas.map { |info| "- #{info.description} (#{info.name})" }.join("\n")}
  MSG
end