Module: Glimmer::DSL::XML::NodeParentExpression
- Includes:
- Glimmer, ParentExpression
- Included in:
- HtmlExpression, MetaExpression, TagExpression, XmlExpression
- Defined in:
- lib/glimmer/dsl/xml/node_parent_expression.rb
Constant Summary
Constants included from Glimmer
Instance Method Summary collapse
Methods included from Glimmer
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Glimmer
Instance Method Details
#add_content(parent, &block) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/glimmer/dsl/xml/node_parent_expression.rb', line 12 def add_content(parent, &block) return_value = block.call(parent) if !return_value.is_a?(Glimmer::XML::Node) and !parent.children.include?(return_value) text = return_value.to_s first_match = text.match(/[#][^{]+[{][^}]+[}]/) match = first_match while (match) instance_eval(parent.text_command(match.pre_match)) tag_text = match.to_s instance_eval(parent.rubyize(tag_text)) text = tag_text post_match = match.post_match match = text.match(/[#]\w+[{]\w+[}]/) end instance_eval(parent.text_command(post_match)) if post_match parent.children << return_value unless first_match end end |