Module: Weft::DSL::Containers::ClassMethods
- Defined in:
- lib/weft/dsl/containers.rb
Instance Method Summary collapse
-
#adds_children_to(ivar) ⇒ Object
Declare that block-style children should be added to the named instance variable instead of the wrapper element itself.
Instance Method Details
#adds_children_to(ivar) ⇒ Object
Declare that block-style children should be added to the named instance variable instead of the wrapper element itself.
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/weft/dsl/containers.rb', line 35 def adds_children_to(ivar) unless ivar.is_a?(Symbol) raise ArgumentError, "adds_children_to expects a Symbol (e.g., :@body), got #{ivar.inspect}" end unless ivar.to_s.start_with?("@") raise Weft::InvalidDefinition, "adds_children_to expects a Symbol that must start with @ (e.g., :@body), got #{ivar.inspect}" end prepend(Containers.behavior_for(ivar)) end |