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.



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

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

Instance Attribute Details

#formulasObject (readonly)

Returns the value of attribute formulas.



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

def formulas
  @formulas
end

#metadataObject (readonly)

Returns the value of attribute metadata.



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

def 
  @metadata
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

Instance Method Details

#to_sObject



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

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