Class: Mixml::Template::Xml
Overview
XML builder based template
Instance Method Summary collapse
-
#evaluate(node) ⇒ String
Evaluate the template.
-
#initialize(proc) ⇒ Xml
constructor
Initialize new XML template.
Methods inherited from Base
Constructor Details
#initialize(proc) ⇒ Xml
Initialize new XML template
12 13 14 |
# File 'lib/mixml/template/xml.rb', line 12 def initialize(proc) @proc = proc end |
Instance Method Details
#evaluate(node) ⇒ String
Evaluate the template
20 21 22 23 24 25 |
# File 'lib/mixml/template/xml.rb', line 20 def evaluate(node) builder = Nokogiri::XML::Builder.new do |xml| @proc.call(node, xml) end builder.to_xml end |