class Fontist::FormulaPicker

Public Class Methods

new(font_name, size_limit:, version:, smallest:, newest:) click to toggle source
# 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

  @options  = {}
  @version  = @options[:version]  = version  if version
  @smallest = @options[:smallest] = smallest if smallest
  @newest   = @options[:newest]   = newest   if newest
end

Public Instance Methods

call(formulas) click to toggle source
# File lib/fontist/formula_picker.rb, line 15
def call(formulas)
  return [] if formulas.empty?

  list = filter(formulas)
  return [] if list.empty?

  choose(list)
end