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.
21 22 23 24 25 26 |
# File 'lib/moxml/adapter/libxml.rb', line 21 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.
19 20 21 |
# File 'lib/moxml/adapter/libxml.rb', line 19 def external_id @external_id end |
#name ⇒ Object
Returns the value of attribute name.
19 20 21 |
# File 'lib/moxml/adapter/libxml.rb', line 19 def name @name end |
#native_doc ⇒ Object (readonly)
Returns the value of attribute native_doc.
18 19 20 |
# File 'lib/moxml/adapter/libxml.rb', line 18 def native_doc @native_doc end |
#system_id ⇒ Object
Returns the value of attribute system_id.
19 20 21 |
# File 'lib/moxml/adapter/libxml.rb', line 19 def system_id @system_id end |
Instance Method Details
#native ⇒ Object
Provide native method to match adapter pattern
29 30 31 |
# File 'lib/moxml/adapter/libxml.rb', line 29 def native @native_doc end |
#to_xml ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/moxml/adapter/libxml.rb', line 33 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 |