--- !ruby/object:RI::ClassDescription 
attributes: 
- !ruby/object:RI::Attribute 
  comment: 
  - !ruby/struct:SM::Flow::P 
    body: A context object for use when the block has no arguments
  name: context
  rw: RW
- !ruby/object:RI::Attribute 
  comment: 
  - !ruby/struct:SM::Flow::P 
    body: The current Document object being built
  name: doc
  rw: RW
- !ruby/object:RI::Attribute 
  comment: 
  - !ruby/struct:SM::Flow::P 
    body: The parent of the current node being built
  name: parent
  rw: RW
class_methods: 
- !ruby/object:RI::MethodSummary 
  name: new
comment: 
- !ruby/struct:SM::Flow::P 
  body: Nokogiri builder can be used for building XML and HTML documents.
- !ruby/struct:SM::Flow::H 
  level: 2
  text: "Synopsis:"
- !ruby/struct:SM::Flow::VERB 
  body: "  builder = Nokogiri::XML::Builder.new do |xml|\n    xml.root {\n      xml.products {\n        xml.widget {\n          xml.id_ &quot;10&quot;\n          xml.name &quot;Awesome widget&quot;\n        }\n      }\n    }\n  end\n  puts builder.to_xml\n"
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Builder scope
- !ruby/struct:SM::Flow::P 
  body: "The builder allows two forms. When the builder is supplied with a block that has a parameter, the outside scope is maintained. This means you can access variables that are outside your builder. If you don't need outside scope, you can use the builder without the &quot;xml&quot; prefix like this:"
- !ruby/struct:SM::Flow::VERB 
  body: "  builder = Nokogiri::XML::Builder.new do\n    root {\n      products {\n        widget {\n          id_ &quot;10&quot;\n          name &quot;Awesome widget&quot;\n        }\n      }\n    }\n  end\n"
- !ruby/struct:SM::Flow::H 
  level: 2
  text: Special Tags
- !ruby/struct:SM::Flow::P 
  body: The builder works by taking advantage of method_missing. Unfortunately some methods are defined in ruby that are difficult or dangerous to remove. You may want to create tags with the name &quot;type&quot;, &quot;class&quot;, and &quot;id&quot; for example. In that case, you can use an underscore to disambiguate your tag name from the method call.
- !ruby/struct:SM::Flow::P 
  body: "Here is an example of using the underscore to disambiguate tag names from ruby methods:"
- !ruby/struct:SM::Flow::VERB 
  body: "  @objects = [Object.new, Object.new, Object.new]\n\n  builder = Nokogiri::XML::Builder.new do |xml|\n    xml.root {\n      xml.objects {\n        @objects.each do |o|\n          xml.object {\n            xml.type_   o.type\n            xml.class_  o.class.name\n            xml.id_     o.id\n          }\n        end\n      }\n    }\n  end\n  puts builder.to_xml\n"
- !ruby/struct:SM::Flow::P 
  body: The underscore may be used with any tag name, and the last underscore will just be removed.
- !ruby/struct:SM::Flow::H 
  level: 2
  text: Tag Attributes
- !ruby/struct:SM::Flow::P 
  body: "Tag attributes may be supplied as method arguments. Here is our previous example, but using attributes rather than tags:"
- !ruby/struct:SM::Flow::VERB 
  body: "  @objects = [Object.new, Object.new, Object.new]\n\n  builder = Nokogiri::XML::Builder.new do |xml|\n    xml.root {\n      xml.objects {\n        @objects.each do |o|\n          xml.object(:type =&gt; o.type, :class =&gt; o.class, :id =&gt; o.id)\n        end\n      }\n    }\n  end\n  puts builder.to_xml\n"
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Tag Attribute Short Cuts
- !ruby/struct:SM::Flow::P 
  body: A couple attribute short cuts are available when building tags. The short cuts are available by special method calls when building a tag.
- !ruby/struct:SM::Flow::P 
  body: "This example builds an &quot;object&quot; tag with the class attribute &quot;classy&quot; and the id of &quot;thing&quot;:"
- !ruby/struct:SM::Flow::VERB 
  body: "  builder = Nokogiri::XML::Builder.new do |xml|\n    xml.root {\n      xml.objects {\n        xml.object.classy.thing!\n      }\n    }\n  end\n  puts builder.to_xml\n"
- !ruby/struct:SM::Flow::P 
  body: All other options are still supported with this syntax, including blocks and extra tag attributes.
constants: []

full_name: Nokogiri::XML::Builder
includes: []

instance_methods: 
- !ruby/object:RI::MethodSummary 
  name: cdata
- !ruby/object:RI::MethodSummary 
  name: text
- !ruby/object:RI::MethodSummary 
  name: to_xml
name: Builder
superclass: Object
