Module: ExpressTemplates::Components::Capabilities::Wrapping
- Included in:
- Base
- Defined in:
- lib/express_templates/components/capabilities/wrapping.rb
Overview
Add the ability for a component template to wrap or decorate a fragment with another fragment.
The insertion point for the inner fragment is marked with _yield
Example:
class MenuComponent < ExpressTemplates::Components::Base
fragments :menu_item, -> { li { (item) } },
:menu_wrapper, -> { ul { _yield } }
for_each -> { }
wrap_with :wrapper
end
Note this example also uses Capabilities::Iterating.
Provides:
-
Wrapping::ClassMethods
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/express_templates/components/capabilities/wrapping.rb', line 30 def self.included(base) base.class_eval do extend ClassMethods include InstanceMethods end end |