Class: Fontist::Import::FormulaBuilder
- Inherits:
-
Object
- Object
- Fontist::Import::FormulaBuilder
- Defined in:
- lib/fontist/import/formula_builder.rb
Direct Known Subclasses
Constant Summary collapse
- FORMULA_ATTRIBUTES =
%i[description homepage resources font_collections fonts extract copyright license_url open_license digest command].freeze
Instance Attribute Summary collapse
-
#archive ⇒ Object
writeonly
Sets the attribute archive.
-
#extractor ⇒ Object
writeonly
Sets the attribute extractor.
-
#font_collection_files ⇒ Object
writeonly
Sets the attribute font_collection_files.
-
#font_files ⇒ Object
writeonly
Sets the attribute font_files.
-
#homepage ⇒ Object
writeonly
Sets the attribute homepage.
-
#license_text ⇒ Object
writeonly
Sets the attribute license_text.
-
#options ⇒ Object
writeonly
Sets the attribute options.
-
#url ⇒ Object
writeonly
Sets the attribute url.
Instance Method Summary collapse
- #formula ⇒ Object
-
#initialize ⇒ FormulaBuilder
constructor
A new instance of FormulaBuilder.
- #name ⇒ Object
Constructor Details
#initialize ⇒ FormulaBuilder
Returns a new instance of FormulaBuilder.
20 21 22 |
# File 'lib/fontist/import/formula_builder.rb', line 20 def initialize @options = {} end |
Instance Attribute Details
#archive=(value) ⇒ Object (writeonly)
Sets the attribute archive
11 12 13 |
# File 'lib/fontist/import/formula_builder.rb', line 11 def archive=(value) @archive = value end |
#extractor=(value) ⇒ Object (writeonly)
Sets the attribute extractor
11 12 13 |
# File 'lib/fontist/import/formula_builder.rb', line 11 def extractor=(value) @extractor = value end |
#font_collection_files=(value) ⇒ Object (writeonly)
Sets the attribute font_collection_files
11 12 13 |
# File 'lib/fontist/import/formula_builder.rb', line 11 def font_collection_files=(value) @font_collection_files = value end |
#font_files=(value) ⇒ Object (writeonly)
Sets the attribute font_files
11 12 13 |
# File 'lib/fontist/import/formula_builder.rb', line 11 def font_files=(value) @font_files = value end |
#homepage=(value) ⇒ Object
Sets the attribute homepage
11 12 13 |
# File 'lib/fontist/import/formula_builder.rb', line 11 def homepage=(value) @homepage = value end |
#license_text=(value) ⇒ Object (writeonly)
Sets the attribute license_text
11 12 13 |
# File 'lib/fontist/import/formula_builder.rb', line 11 def license_text=(value) @license_text = value end |
#options=(value) ⇒ Object (writeonly)
Sets the attribute options
11 12 13 |
# File 'lib/fontist/import/formula_builder.rb', line 11 def (value) @options = value end |
#url=(value) ⇒ Object (writeonly)
Sets the attribute url
11 12 13 |
# File 'lib/fontist/import/formula_builder.rb', line 11 def url=(value) @url = value end |
Instance Method Details
#formula ⇒ Object
24 25 26 |
# File 'lib/fontist/import/formula_builder.rb', line 24 def formula formula_attributes.map { |name| [name, send(name)] }.to_h.compact end |
#name ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/fontist/import/formula_builder.rb', line 28 def name return @options[:name] if @options[:name] unique_names = both_fonts.map(&:family_name).uniq TextHelper.longest_common_prefix(unique_names) || both_fonts.first.family_name end |