Class: Moxml::Adapter::Libxml::DoctypeWrapper
- Inherits:
-
Object
- Object
- Moxml::Adapter::Libxml::DoctypeWrapper
- Defined in:
- lib/moxml/adapter/libxml.rb
Overview
Wrapper class to store DOCTYPE information
Instance Attribute Summary collapse
-
#external_id ⇒ Object
Returns the value of attribute external_id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#native_doc ⇒ Object
readonly
Returns the value of attribute native_doc.
-
#system_id ⇒ Object
Returns the value of attribute system_id.
Instance Method Summary collapse
-
#initialize(doc, name, external_id, system_id) ⇒ DoctypeWrapper
constructor
A new instance of DoctypeWrapper.
-
#native ⇒ Object
Provide native method to match adapter pattern.
- #to_xml ⇒ Object
Constructor Details
#initialize(doc, name, external_id, system_id) ⇒ DoctypeWrapper
Returns a new instance of DoctypeWrapper.
15 16 17 18 19 20 |
# File 'lib/moxml/adapter/libxml.rb', line 15 def initialize(doc, name, external_id, system_id) @native_doc = doc @name = name @external_id = external_id @system_id = system_id end |
Instance Attribute Details
#external_id ⇒ Object
Returns the value of attribute external_id.
13 14 15 |
# File 'lib/moxml/adapter/libxml.rb', line 13 def external_id @external_id end |
#name ⇒ Object
Returns the value of attribute name.
13 14 15 |
# File 'lib/moxml/adapter/libxml.rb', line 13 def name @name end |
#native_doc ⇒ Object (readonly)
Returns the value of attribute native_doc.
12 13 14 |
# File 'lib/moxml/adapter/libxml.rb', line 12 def native_doc @native_doc end |
#system_id ⇒ Object
Returns the value of attribute system_id.
13 14 15 |
# File 'lib/moxml/adapter/libxml.rb', line 13 def system_id @system_id end |
Instance Method Details
#native ⇒ Object
Provide native method to match adapter pattern
23 24 25 |
# File 'lib/moxml/adapter/libxml.rb', line 23 def native @native_doc end |
#to_xml ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/moxml/adapter/libxml.rb', line 27 def to_xml output = "<!DOCTYPE #{@name}" if @external_id && !@external_id.empty? output << " PUBLIC \"#{@external_id}\"" output << " \"#{@system_id}\"" if @system_id elsif @system_id && !@system_id.empty? output << " SYSTEM \"#{@system_id}\"" end output << ">" output end |