Module: Ditty::Components::Base::ClassMethods
- Included in:
- Ditty
- Defined in:
- lib/ditty.rb
Instance Method Summary collapse
-
#component(component, *args, &block) ⇒ Object
Load a new component into the current class.
Instance Method Details
#component(component, *args, &block) ⇒ Object
119 120 121 122 123 124 125 126 127 |
# File 'lib/ditty.rb', line 119 def component(component, *args, &block) raise ComponentError, 'Cannot add a component to a frozen Component class' if frozen? component = Components.load_component(component) if component.is_a?(Symbol) include(component::InstanceMethods) if defined?(component::InstanceMethods) extend(component::ClassMethods) if defined?(component::ClassMethods) component.configure(self, *args, &block) if component.respond_to?(:configure) nil end |