Module | Amrita::Node |
In: |
lib/amrita/node_expand.rb
lib/amrita/format.rb lib/amrita/node.rb |
Base module for HTML elements
expand self as a template with a model data.
# File lib/amrita/node_expand.rb, line 278 def expand(data, context=DefaultContext.clone) case data when true self when nil, false Null when DictionaryData expand1(data, context) else raise TypeError, "Amrita::Node#expand accepts only Hash or ExpandByMember as model data (#{data.class} was passed)" end end
converts an Element without id to TextElement to make tree low for performance.
A pre-formatted Node tree will be expanded faster than original. But, it produces the same output .
# File lib/amrita/format.rb, line 524 def pre_format(formatter, expand_attr=false) raise "pre_format dose not suport pretty-print" if formatter.kind_of?(PrettyPrintFormatter) prf = PreFormatter.new(formatter, expand_attr) prf.pre_format(self) prf end