Class: Taurus::XML::DocType
- Inherits:
-
Object
- Object
- Taurus::XML::DocType
- Defined in:
- lib/taurus/xml/doc_type.rb
Instance Attribute Summary collapse
-
#c_ptr ⇒ Object
readonly
Returns the value of attribute c_ptr.
-
#document ⇒ Object
readonly
Returns the value of attribute document.
Instance Method Summary collapse
- #external_id ⇒ Object
-
#initialize(c_ptr, document) ⇒ DocType
constructor
A new instance of DocType.
- #inspect ⇒ Object
- #internal_subset ⇒ Object
- #name ⇒ Object (also: #node_name)
- #public_id ⇒ Object
- #root_name ⇒ Object
- #system_id ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(c_ptr, document) ⇒ DocType
Returns a new instance of DocType.
6 7 8 9 |
# File 'lib/taurus/xml/doc_type.rb', line 6 def initialize(c_ptr, document) @c_ptr = c_ptr @document = document end |
Instance Attribute Details
#c_ptr ⇒ Object (readonly)
Returns the value of attribute c_ptr.
4 5 6 |
# File 'lib/taurus/xml/doc_type.rb', line 4 def c_ptr @c_ptr end |
#document ⇒ Object (readonly)
Returns the value of attribute document.
4 5 6 |
# File 'lib/taurus/xml/doc_type.rb', line 4 def document @document end |
Instance Method Details
#external_id ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/taurus/xml/doc_type.rb', line 32 def external_id pub = public_id sys = system_id return nil if pub.nil? && sys.nil? parts = [] parts << "PUBLIC \"#{pub}\"" if pub parts << "SYSTEM \"#{sys}\"" if sys && pub.nil? parts << "\"#{sys}\"" if pub && sys parts.join(" ") end |
#inspect ⇒ Object
51 52 53 |
# File 'lib/taurus/xml/doc_type.rb', line 51 def inspect "#<#{self.class.name} name=#{name.inspect} public=#{public_id.inspect} system=#{system_id.inspect}>" end |
#internal_subset ⇒ Object
28 29 30 |
# File 'lib/taurus/xml/doc_type.rb', line 28 def internal_subset Taurus::XML::FFI.taurus_doctype_get_internal_subset(@c_ptr) end |
#name ⇒ Object Also known as: node_name
11 12 13 |
# File 'lib/taurus/xml/doc_type.rb', line 11 def name Taurus::XML::FFI.taurus_doctype_get_name(@c_ptr) end |
#public_id ⇒ Object
20 21 22 |
# File 'lib/taurus/xml/doc_type.rb', line 20 def public_id Taurus::XML::FFI.taurus_doctype_get_public_id(@c_ptr) end |
#root_name ⇒ Object
16 17 18 |
# File 'lib/taurus/xml/doc_type.rb', line 16 def root_name Taurus::XML::FFI.taurus_doctype_get_root_name(@c_ptr) end |
#system_id ⇒ Object
24 25 26 |
# File 'lib/taurus/xml/doc_type.rb', line 24 def system_id Taurus::XML::FFI.taurus_doctype_get_system_id(@c_ptr) end |
#to_s ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/taurus/xml/doc_type.rb', line 43 def to_s inner = internal_subset parts = ["<!DOCTYPE #{name}"] parts << external_id if external_id parts << "[#{inner}]" if inner && !inner.empty? parts.join(" ") + ">" end |