class Lookbook::TagStore
def self.default_config
def self.default_config ConfigLoader.call(CONFIG_FILE) end
def self.init_from_config
def self.init_from_config new(default_config) end
def add_tag(name, opts = nil)
def add_tag(name, opts = nil) name = name.to_sym if store.key?(name) raise ConfigError.new("tag with name '#{name}' already exists", scope: "tags.config") else store[name] = build_config(name, opts) end end
def build_config(name, opts = nil)
def build_config(name, opts = nil) Store.new({ name: name.to_sym, label: name.to_s.titleize, options: opts.to_h }) end
def get_tag(name)
def get_tag(name) store[name.to_sym] end
def initialize(config = nil)
def initialize(config = nil) @store = {} config.to_h.each { |k, v| add_tag(k, v) } end