Sha256: 1b876341efe61f3ac685355a25231c56d2f7cc58bd732bedf0e5a99412630bb8
Contents?: true
Size: 747 Bytes
Versions: 1
Compression:
Stored size: 747 Bytes
Contents
# frozen_string_literal: true module Zyra # @api private # # Registry of all registered builders class Registry # (see Zyra.register) def register(klass, key = klass.name.gsub(/::([A-Z])/, '_\1').downcase) registry[key.to_sym] = Builder.new(klass) end # Returns a registered builder # # when the builder was not registerd, +nil+ is returned # # @param key [String,Symbol] key under which the builder is registered # # @return [Zyra::Builder] def builder_for(key) registry[key.to_sym] end private # @private # # Registry store for all builders # # @return [Hash] map of all registered builders def registry @registry ||= {} end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
zyra-0.0.2 | lib/zyra/registry.rb |