class Nokogiri::XML::Builder::NodeBuilder

def method_missing(method, *args, &block)

def method_missing(method, *args, &block)
  opts = args.last.is_a?(Hash) ? args.pop : {}
  case method.to_s
  when /^(.*)!$/
    @node["id"] = Regexp.last_match(1)
    @node.content = args.first if args.first
  when /^(.*)=/
    @node[Regexp.last_match(1)] = args.first
  else
    @node["class"] =
      ((@node["class"] || "").split(/\s/) + [method.to_s]).join(" ")
    @node.content = args.first if args.first
  end
  # Assign any extra options
  opts.each do |k, v|
    @node[k.to_s] = ((@node[k.to_s] || "").split(/\s/) + [v]).join(" ")
  end
  if block
    old_parent = @doc_builder.parent
    @doc_builder.parent = @node
    value = @doc_builder.instance_eval(&block)
    @doc_builder.parent = old_parent
    return value
  end
  self
end