Class: Oga::XML::XmlDeclaration
- Inherits:
-
ProcessingInstruction
- Object
- Node
- CharacterNode
- ProcessingInstruction
- Oga::XML::XmlDeclaration
- Defined in:
- lib/oga/xml/xml_declaration.rb
Overview
Class containing information about an XML declaration tag.
Instance Attribute Summary collapse
-
#encoding ⇒ String
-
#standalone ⇒ String
Whether or not the document is a standalone document.
-
#version ⇒ String
Attributes inherited from ProcessingInstruction
Attributes inherited from CharacterNode
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ XmlDeclaration
constructor
A new instance of XmlDeclaration.
-
#inspect ⇒ String
Methods inherited from Node
#after, #before, #children, #children=, #each_ancestor, #html?, #next_element, #parent, #previous_element, #remove, #replace, #root_node, #xml?
Methods included from ToXML
Methods included from Traversal
Constructor Details
#initialize(options = {}) ⇒ XmlDeclaration
Returns a new instance of XmlDeclaration
20 21 22 23 24 25 26 27 |
# File 'lib/oga/xml/xml_declaration.rb', line 20 def initialize( = {}) super @version = [:version] || '1.0' @encoding = [:encoding] || 'UTF-8' @standalone = [:standalone] @name = 'xml' end |
Instance Attribute Details
#encoding ⇒ String
9 10 11 |
# File 'lib/oga/xml/xml_declaration.rb', line 9 def encoding @encoding end |
#standalone ⇒ String
Whether or not the document is a standalone document.
13 14 15 |
# File 'lib/oga/xml/xml_declaration.rb', line 13 def standalone @standalone end |
#version ⇒ String
6 7 8 |
# File 'lib/oga/xml/xml_declaration.rb', line 6 def version @version end |
Instance Method Details
#inspect ⇒ String
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/oga/xml/xml_declaration.rb', line 30 def inspect segments = [] [:version, :encoding, :standalone].each do |attr| value = send(attr) if value and !value.empty? segments << "#{attr}: #{value.inspect}" end end "XmlDeclaration(#{segments.join(' ')})" end |