Class: Moxml::Adapter::CustomizedLeptris::Doctype

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

Overview

Wrapper for a programmatic DOCTYPE. libleptris only parses DOCTYPEs from source; it has no API to create one, so Moxml stores this value object in the document's attachments.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, external_id = nil, system_id = nil) ⇒ Doctype

Returns a new instance of Doctype.



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

def initialize(name, external_id = nil, system_id = nil)
  @name = name
  @external_id = external_id
  @system_id = system_id
end

Instance Attribute Details

#external_idObject

Returns the value of attribute external_id.



10
11
12
# File 'lib/moxml/adapter/customized_leptris/doctype.rb', line 10

def external_id
  @external_id
end

#nameObject

Returns the value of attribute name.



10
11
12
# File 'lib/moxml/adapter/customized_leptris/doctype.rb', line 10

def name
  @name
end

#parent_docObject

Returns the value of attribute parent_doc.



10
11
12
# File 'lib/moxml/adapter/customized_leptris/doctype.rb', line 10

def parent_doc
  @parent_doc
end

#system_idObject

Returns the value of attribute system_id.



10
11
12
# File 'lib/moxml/adapter/customized_leptris/doctype.rb', line 10

def system_id
  @system_id
end

Instance Method Details

#==(other) ⇒ Object



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

def ==(other)
  other.is_a?(self.class) &&
    name == other.name &&
    external_id == other.external_id &&
    system_id == other.system_id
end

#to_xmlObject



18
19
20
# File 'lib/moxml/adapter/customized_leptris/doctype.rb', line 18

def to_xml
  XmlEmitter.doctype_xml(name, external_id, system_id)
end