Module: DesignSystem::Registry
- Defined in:
- lib/design_system/registry.rb
Overview
This provides a design system factory
Class Attribute Summary collapse
-
.design_systems ⇒ Object
Returns the value of attribute design_systems.
Class Method Summary collapse
- .builder(brand, klass_name, context) ⇒ Object
- .form_builder(brand) ⇒ Object
- .register(brand) ⇒ Object
- .unregister(*brands) ⇒ Object
Class Attribute Details
.design_systems ⇒ Object
Returns the value of attribute design_systems.
5 6 7 |
# File 'lib/design_system/registry.rb', line 5 def design_systems @design_systems end |
Class Method Details
.builder(brand, klass_name, context) ⇒ Object
19 20 21 22 23 |
# File 'lib/design_system/registry.rb', line 19 def builder(brand, klass_name, context) klass = namespaced_builder_klass(brand, klass_name) klass.new(context) end |
.form_builder(brand) ⇒ Object
25 26 27 |
# File 'lib/design_system/registry.rb', line 25 def form_builder(brand) "DesignSystem::#{brand.camelcase}::FormBuilder".constantize end |
.register(brand) ⇒ Object
7 8 9 10 11 |
# File 'lib/design_system/registry.rb', line 7 def register(brand) @design_systems ||= [] @design_systems << brand end |
.unregister(*brands) ⇒ Object
13 14 15 16 17 |
# File 'lib/design_system/registry.rb', line 13 def unregister(*brands) brands.each do |brand| @design_systems.delete(brand) end end |