Sha256: 7cf41abc0be9f9c6503e49a6cc208433ef756f2e377ec854f90ace57430bd4db
Contents?: true
Size: 898 Bytes
Versions: 9
Compression:
Stored size: 898 Bytes
Contents
module Fontist class Registry include Singleton def initialize @formulas ||= {} end def formulas parse_to_object(@formulas) end def self.formulas instance.formulas end def self.register(formula, key = nil) key ||= formula.instance.key || formula.to_s instance.register(formula, key) end def register(formula, key) @formulas[key] = build_formula_data(formula) end private def build_formula_data(formula) { installer: formula, fonts: formula.instance.fonts, license: formula.instance.license, homepage: formula.instance.homepage , description: formula.instance.description, license_required: formula.instance.license_required, } end def parse_to_object(data) JSON.parse(data.to_json, object_class: OpenStruct) end end end
Version data entries
9 entries across 9 versions & 1 rubygems