Class: Moxml::Adapter::CustomizedOga::XmlDeclaration

Inherits:
Oga::XML::XmlDeclaration
  • Object
show all
Defined in:
lib/moxml/adapter/customized_oga/xml_declaration.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ XmlDeclaration

Returns a new instance of XmlDeclaration.



9
10
11
12
13
# File 'lib/moxml/adapter/customized_oga/xml_declaration.rb', line 9

def initialize(options = {})
  @version    = options[:version] || "1.0"
  @encoding   = options[:encoding]
  @standalone = options[:standalone]
end

Instance Method Details

#to_xmlObject



15
16
17
18
19
20
21
# File 'lib/moxml/adapter/customized_oga/xml_declaration.rb', line 15

def to_xml
  parts = ["<?xml"]
  parts << %( version="#{version}") if version
  parts << %( encoding="#{encoding}") if encoding
  parts << %( standalone="#{standalone}") if standalone
  "#{parts.join}?>"
end