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
# File lib/tilt/nokogiri.rb 13 def evaluate(scope, locals) 14 if data.respond_to?(:to_str) 15 wrapper = proc { yield.sub(DOCUMENT_HEADER, "") } if block_given? 16 super(scope, locals, &wrapper) 17 else 18 ::Nokogiri::XML::Builder.new.tap(&data).to_xml 19 end 20 end
precompiled_postamble(locals)
click to toggle source
# File lib/tilt/nokogiri.rb 27 def precompiled_postamble(locals) 28 "xml.to_xml" 29 end
precompiled_preamble(locals)
click to toggle source
Calls superclass method
# File lib/tilt/nokogiri.rb 22 def precompiled_preamble(locals) 23 return super if locals.include? :xml 24 "xml = ::Nokogiri::XML::Builder.new { |xml| }\n#{super}" 25 end
precompiled_template(locals)
click to toggle source
# File lib/tilt/nokogiri.rb 31 def precompiled_template(locals) 32 data.to_str 33 end
prepare()
click to toggle source
# File lib/tilt/nokogiri.rb 11 def prepare; end