Class: Fontist::FormulaPicker
- Inherits:
-
Object
- Object
- Fontist::FormulaPicker
- Defined in:
- lib/fontist/formula_picker.rb
Instance Method Summary collapse
- #call(formulas) ⇒ Object
-
#initialize(font_name, size_limit:, version:, smallest:, newest:) ⇒ FormulaPicker
constructor
A new instance of FormulaPicker.
Constructor Details
#initialize(font_name, size_limit:, version:, smallest:, newest:) ⇒ FormulaPicker
Returns a new instance of FormulaPicker.
5 6 7 8 9 10 11 |
# File 'lib/fontist/formula_picker.rb', line 5 def initialize(font_name, size_limit:, version:, smallest:, newest:) @font_name = font_name @size_limit = size_limit || Fontist.formula_size_limit_in_megabytes @version = version @smallest = smallest @newest = newest end |
Instance Method Details
#call(formulas) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/fontist/formula_picker.rb', line 13 def call(formulas) return [] if formulas.size.zero? return formulas if contain_different_styles?(formulas) return by_version(formulas) if version_is_passed? return newest(formulas) if newest_is_passed? return smallest(formulas) if smallest_is_passed? default_way(formulas) end |