Class: XmlUtils::XMLDecl
- Inherits:
-
ProcessingInstruction
- Object
- Node
- ChildNode
- ProcessingInstruction
- XmlUtils::XMLDecl
- Defined in:
- lib/xmlutils/node.rb
Instance Attribute Summary collapse
-
#encoding ⇒ Object
Returns the value of attribute encoding.
-
#standalone ⇒ Object
Returns the value of attribute standalone.
-
#version ⇒ Object
Returns the value of attribute version.
Attributes inherited from ProcessingInstruction
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(version = "1.0", encoding = nil, standalone = nil, parent = nil) ⇒ XMLDecl
constructor
A new instance of XMLDecl.
- #node_type ⇒ Object
- #write_content(output, indent = 0) ⇒ Object
Methods inherited from ProcessingInstruction
Methods inherited from ChildNode
Methods inherited from Node
#deep_clone, #document, #each, #next_sibling, #previous_sibling, #remove, #root, #to_s
Constructor Details
#initialize(version = "1.0", encoding = nil, standalone = nil, parent = nil) ⇒ XMLDecl
Returns a new instance of XMLDecl.
282 283 284 285 286 287 |
# File 'lib/xmlutils/node.rb', line 282 def initialize(version = "1.0", encoding = nil, standalone = nil, parent = nil) super('xml', nil, parent) @version = version @encoding = encoding @standalone = standalone end |
Instance Attribute Details
#encoding ⇒ Object
Returns the value of attribute encoding.
280 281 282 |
# File 'lib/xmlutils/node.rb', line 280 def encoding @encoding end |
#standalone ⇒ Object
Returns the value of attribute standalone.
280 281 282 |
# File 'lib/xmlutils/node.rb', line 280 def standalone @standalone end |
#version ⇒ Object
Returns the value of attribute version.
280 281 282 |
# File 'lib/xmlutils/node.rb', line 280 def version @version end |
Instance Method Details
#node_type ⇒ Object
289 290 291 |
# File 'lib/xmlutils/node.rb', line 289 def node_type :xmldecl end |
#write_content(output, indent = 0) ⇒ Object
293 294 295 296 297 298 |
# File 'lib/xmlutils/node.rb', line 293 def write_content(output, indent = 0) attrs = ["version=\"#{@version}\""] attrs << "encoding=\"#{@encoding}\"" if @encoding attrs << "standalone=\"#{@standalone}\"" if @standalone output << "<?xml #{attrs.join(' ')}?>" end |