Sha256: 22d76ce3eb0c35c0a26493daf047ed24b19217e7721f1b184f5dde83fca13c6e
Contents?: true
Size: 837 Bytes
Versions: 7
Compression:
Stored size: 837 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, } end def parse_to_object(data) JSON.parse(data.to_json, object_class: OpenStruct) end end end
Version data entries
7 entries across 6 versions & 2 rubygems