class Tilt::NokogiriTemplate
Nokogiri template implementation. See: nokogiri.org/
Constants
- DOCUMENT_HEADER
Public Instance Methods
evaluate(scope, locals) { || ... }
click to toggle source
Calls superclass method
Template#evaluate
# File lib/tilt/nokogiri.rb, line 13 def evaluate(scope, locals) if data.respond_to?(:to_str) wrapper = proc { yield.sub(DOCUMENT_HEADER, "") } if block_given? super(scope, locals, &wrapper) else ::Nokogiri::XML::Builder.new.tap(&data).to_xml end end
precompiled_postamble(locals)
click to toggle source
# File lib/tilt/nokogiri.rb, line 27 def precompiled_postamble(locals) "xml.to_xml" end
precompiled_preamble(locals)
click to toggle source
Calls superclass method
Template#precompiled_preamble
# File lib/tilt/nokogiri.rb, line 22 def precompiled_preamble(locals) return super if locals.include? :xml "xml = ::Nokogiri::XML::Builder.new { |xml| }\n#{super}" end
precompiled_template(locals)
click to toggle source
# File lib/tilt/nokogiri.rb, line 31 def precompiled_template(locals) data.to_str end
prepare()
click to toggle source
# File lib/tilt/nokogiri.rb, line 11 def prepare; end