Class: Fontist::Import::Google::FormulaBuilders::BaseFormulaBuilder
- Inherits:
-
Object
- Object
- Fontist::Import::Google::FormulaBuilders::BaseFormulaBuilder
- Defined in:
- lib/fontist/import/google/formula_builders/base_formula_builder.rb
Overview
Base class for Google Fonts formula builders
Subclasses implement version-specific formula generation. Use FormulaBuilder.for_version(version) to get the appropriate builder.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#family ⇒ Object
readonly
Returns the value of attribute family.
-
#github_index ⇒ Object
readonly
Returns the value of attribute github_index.
-
#ttf_files ⇒ Object
readonly
Returns the value of attribute ttf_files.
-
#woff2_files ⇒ Object
readonly
Returns the value of attribute woff2_files.
Class Method Summary collapse
-
.for_version(version) ⇒ Object
Get the appropriate builder class for a version.
Instance Method Summary collapse
-
#build ⇒ Object
Build formula hash for the family Subclasses must implement this method.
-
#initialize(family, github_index:, ttf_files:, woff2_files:) ⇒ BaseFormulaBuilder
constructor
A new instance of BaseFormulaBuilder.
-
#version ⇒ Object
Version number for this builder Subclasses must implement this method.
Constructor Details
#initialize(family, github_index:, ttf_files:, woff2_files:) ⇒ BaseFormulaBuilder
Returns a new instance of BaseFormulaBuilder.
14 15 16 17 18 19 |
# File 'lib/fontist/import/google/formula_builders/base_formula_builder.rb', line 14 def initialize(family, github_index:, ttf_files:, woff2_files:) @family = family @github_index = github_index @ttf_files = ttf_files @woff2_files = woff2_files end |
Instance Attribute Details
#family ⇒ Object (readonly)
Returns the value of attribute family.
12 13 14 |
# File 'lib/fontist/import/google/formula_builders/base_formula_builder.rb', line 12 def family @family end |
#github_index ⇒ Object (readonly)
Returns the value of attribute github_index.
12 13 14 |
# File 'lib/fontist/import/google/formula_builders/base_formula_builder.rb', line 12 def github_index @github_index end |
#ttf_files ⇒ Object (readonly)
Returns the value of attribute ttf_files.
12 13 14 |
# File 'lib/fontist/import/google/formula_builders/base_formula_builder.rb', line 12 def ttf_files @ttf_files end |
#woff2_files ⇒ Object (readonly)
Returns the value of attribute woff2_files.
12 13 14 |
# File 'lib/fontist/import/google/formula_builders/base_formula_builder.rb', line 12 def woff2_files @woff2_files end |
Class Method Details
.for_version(version) ⇒ Object
Get the appropriate builder class for a version
79 80 81 82 83 84 85 86 87 88 |
# File 'lib/fontist/import/google/formula_builders/base_formula_builder.rb', line 79 def self.for_version(version) case version when 4 FormulaBuilderV4 when 5 FormulaBuilderV5 else raise ArgumentError, "Unknown formula version: #{version}" end end |
Instance Method Details
#build ⇒ Object
Build formula hash for the family Subclasses must implement this method
23 24 25 |
# File 'lib/fontist/import/google/formula_builders/base_formula_builder.rb', line 23 def build raise NotImplementedError, "Subclasses must implement #build" end |
#version ⇒ Object
Version number for this builder Subclasses must implement this method
29 30 31 |
# File 'lib/fontist/import/google/formula_builders/base_formula_builder.rb', line 29 def version raise NotImplementedError, "Subclasses must implement #version" end |