Module: ExpressTemplates::Components::Capabilities::Parenting
- Included in:
- ExpressTemplates::Components::Container
- Defined in:
- lib/express_templates/components/capabilities/parenting.rb
Defined Under Namespace
Modules: InstanceMethods
Class Method Summary collapse
-
.included(base) ⇒ Object
Parenting adds the capability for a component to have and render children that may be specified in the template fragment which includes the component.
Class Method Details
.included(base) ⇒ Object
Parenting adds the capability for a component to have and render children that may be specified in the template fragment which includes the component.
Example parenting component:
class Line < ExpressTemplates::Components::Base
include Capabilities::Parenting
emits { p.line { _yield } }
end
You might then use this component like so:
line "In", "Xanadu", "did", "Kubla", "Khan"
line { "A stately pleasure-dome decree :" }
line { "Where Alph, the sacred river, ran" }
line %q(Through caverns measureless to man)
line %q|Down to a sunless sea.|
Provides
-
ClassMethods for rendering
-
InstanceMethods for managing children
31 32 33 34 35 |
# File 'lib/express_templates/components/capabilities/parenting.rb', line 31 def self.included(base) base.class_eval do include InstanceMethods end end |