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[name platforms description homepage resources font_collections fonts extract copyright license_url requires_license_agreement open_license digest command].freeze
Instance Attribute Summary collapse
- 
  
    
      #font_collection_files  ⇒ Object 
    
    
  
  
  
  
    
    
      writeonly
    
  
  
  
  
  
  
    
Sets the attribute font_collection_files.
 - 
  
    
      #font_files  ⇒ Object 
    
    
  
  
  
  
    
    
      writeonly
    
  
  
  
  
  
  
    
Sets the attribute font_files.
 - 
  
    
      #license_text  ⇒ Object 
    
    
  
  
  
  
    
    
      writeonly
    
  
  
  
  
  
  
    
Sets the attribute license_text.
 - 
  
    
      #operations  ⇒ Object 
    
    
  
  
  
  
    
    
      writeonly
    
  
  
  
  
  
  
    
Sets the attribute operations.
 - 
  
    
      #options  ⇒ Object 
    
    
  
  
  
  
    
    
      writeonly
    
  
  
  
  
  
  
    
Sets the attribute options.
 - 
  
    
      #resources  ⇒ Object 
    
    
  
  
  
  
    
    
      writeonly
    
  
  
  
  
  
  
    
Sets the attribute resources.
 
Instance Method Summary collapse
- #formula ⇒ Object
 - 
  
    
      #initialize  ⇒ FormulaBuilder 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of FormulaBuilder.
 - #save ⇒ Object
 
Constructor Details
#initialize ⇒ FormulaBuilder
Returns a new instance of FormulaBuilder.
      20 21 22 23 24  | 
    
      # File 'lib/fontist/import/formula_builder.rb', line 20 def initialize @options = {} @font_files = [] @font_collection_files = [] end  | 
  
Instance Attribute Details
#font_collection_files=(value) ⇒ Object (writeonly)
Sets the attribute font_collection_files
      13 14 15  | 
    
      # File 'lib/fontist/import/formula_builder.rb', line 13 def font_collection_files=(value) @font_collection_files = value end  | 
  
#font_files=(value) ⇒ Object (writeonly)
Sets the attribute font_files
      13 14 15  | 
    
      # File 'lib/fontist/import/formula_builder.rb', line 13 def font_files=(value) @font_files = value end  | 
  
#license_text=(value) ⇒ Object (writeonly)
Sets the attribute license_text
      13 14 15  | 
    
      # File 'lib/fontist/import/formula_builder.rb', line 13 def license_text=(value) @license_text = value end  | 
  
#operations=(value) ⇒ Object (writeonly)
Sets the attribute operations
      13 14 15  | 
    
      # File 'lib/fontist/import/formula_builder.rb', line 13 def operations=(value) @operations = value end  | 
  
#options=(value) ⇒ Object (writeonly)
Sets the attribute options
      13 14 15  | 
    
      # File 'lib/fontist/import/formula_builder.rb', line 13 def (value) @options = value end  | 
  
#resources=(value) ⇒ Object
Sets the attribute resources
      13 14 15  | 
    
      # File 'lib/fontist/import/formula_builder.rb', line 13 def resources=(value) @resources = value end  | 
  
Instance Method Details
#formula ⇒ Object
      26 27 28  | 
    
      # File 'lib/fontist/import/formula_builder.rb', line 26 def formula formula_attributes.map { |name| [name, send(name)] }.to_h.compact end  | 
  
#save ⇒ Object
      30 31 32 33 34 35  | 
    
      # File 'lib/fontist/import/formula_builder.rb', line 30 def save path = vacant_path yaml = YAML.dump(Helpers::HashHelper.stringify_keys(formula)) File.write(path, yaml) path end  |