class Nokogiri::XML::Builder
def initialize(options = {}, root = nil, &block)
...
Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
Building a document with a particular encoding for example:
Document that is being built.
Create a new Builder object. +options+ are sent to the top level
##
def initialize(options = {}, root = nil, &block) if root @doc = root.document @parent = root else @parent = @doc = related_class("Document").new end @context = nil @arity = nil @ns = nil options = DEFAULT_DOCUMENT_OPTIONS.merge(options) options.each do |k, v| @doc.send(:"#{k}=", v) end return unless block @arity = block.arity if @arity <= 0 @context = eval("self", block.binding) instance_eval(&block) else yield self end @parent = @doc end