Class: Moxml::Adapter::CustomizedLeptris::Declaration

Inherits:
Object
  • Object
show all
Defined in:
lib/moxml/adapter/customized_leptris/declaration.rb

Overview

Wrapper for an XML declaration. libleptris stores declaration data on the document struct (read-only, serialized via options) and has no first-class declaration node, so Moxml exposes this mutable value object instead.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(version = "1.0", encoding = "UTF-8", standalone = nil) ⇒ Declaration

Returns a new instance of Declaration.



13
14
15
16
17
# File 'lib/moxml/adapter/customized_leptris/declaration.rb', line 13

def initialize(version = "1.0", encoding = "UTF-8", standalone = nil)
  @version = version
  @encoding = encoding
  @standalone = standalone
end

Instance Attribute Details

#encodingObject

Returns the value of attribute encoding.



11
12
13
# File 'lib/moxml/adapter/customized_leptris/declaration.rb', line 11

def encoding
  @encoding
end

#parent_docObject

Returns the value of attribute parent_doc.



11
12
13
# File 'lib/moxml/adapter/customized_leptris/declaration.rb', line 11

def parent_doc
  @parent_doc
end

#standaloneObject

Returns the value of attribute standalone.



11
12
13
# File 'lib/moxml/adapter/customized_leptris/declaration.rb', line 11

def standalone
  @standalone
end

#versionObject

Returns the value of attribute version.



11
12
13
# File 'lib/moxml/adapter/customized_leptris/declaration.rb', line 11

def version
  @version
end

Instance Method Details

#==(other) ⇒ Object



23
24
25
26
27
28
# File 'lib/moxml/adapter/customized_leptris/declaration.rb', line 23

def ==(other)
  other.is_a?(self.class) &&
    version == other.version &&
    encoding == other.encoding &&
    standalone == other.standalone
end

#to_xmlObject



19
20
21
# File 'lib/moxml/adapter/customized_leptris/declaration.rb', line 19

def to_xml
  XmlEmitter.declaration_xml(version, encoding, standalone)
end