class Nokogiri::XML::Builder
def method_missing(method, *args, &block) # :nodoc:
def method_missing(method, *args, &block) # :nodoc: if @context && @context.respond_to?(method) @context.send(method, *args, &block) else node = @doc.create_element(method.to_s.sub(/[_!]$/, ""), *args) { |n| # Set up the namespace if @ns.is_a? Nokogiri::XML::Namespace n.namespace = @ns @ns = nil end } if @ns.is_a? Hash node.namespace = node.namespace_definitions.find { |x| x.prefix == @ns[:pending] } if node.namespace.nil? raise ArgumentError, "Namespace #{@ns[:pending]} has not been defined" end @ns = nil end insert(node, &block) end end