Class: Zyra::Registry Private
- Inherits:
-
Object
- Object
- Zyra::Registry
- Defined in:
- lib/zyra/registry.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Registry of all registered builders
Instance Method Summary collapse
-
#builder_for(key) ⇒ Zyra::Builder
private
Returns a registered builder.
-
#register(klass, key = klass.name.gsub(/::([A-Z])/, '_\1').downcase) ⇒ Zyra::Builder
Register a new builder.
Instance Method Details
#builder_for(key) ⇒ Zyra::Builder
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a registered builder
when the builder was not registerd, nil is returned
20 21 22 |
# File 'lib/zyra/registry.rb', line 20 def builder_for(key) registry[key.to_sym] end |
#register(klass) ⇒ Zyra::Builder #register(klass, key) ⇒ Zyra::Builder
Register a new builder
The builder will focus on one class and be registered under a symbol key
9 10 11 |
# File 'lib/zyra/registry.rb', line 9 def register(klass, key = klass.name.gsub(/::([A-Z])/, '_\1').downcase) registry[key.to_sym] = Builder.new(klass) end |