Class: Itonoko::XML::ProcessingInstruction

Inherits:
Node
  • Object
show all
Defined in:
lib/itonoko/xml/text.rb

Constant Summary

Constants inherited from Node

Node::ATTRIBUTE_NODE, Node::CDATA_SECTION_NODE, Node::COMMENT_NODE, Node::DOCUMENT_FRAGMENT_NODE, Node::DOCUMENT_NODE, Node::DOCUMENT_TYPE_NODE, Node::ELEMENT_NODE, Node::EMPTY_ATTRS, Node::EMPTY_CHILDREN, Node::PROCESSING_INSTRUCTION_NODE, Node::TEXT_NODE

Instance Attribute Summary collapse

Attributes inherited from Node

#children, #document, #node_name, #node_type, #parent

Instance Method Summary collapse

Methods inherited from Node

#==, #[], #[]=, #add_child, #add_next_sibling, #add_previous_sibling, #ancestors, #append_child, #at, #at_css, #at_xpath, #attribute, #attribute_nodes, #attributes, #cdata_node?, #child, #comment?, #css, #description, #document?, #element?, #element_children, #fragment?, #get_attribute, #has_attribute?, #inner_html, #inner_html=, #inspect, #keys, #matches?, #name, #next_element, #next_sibling, #prepend_child, #previous_element, #previous_sibling, #remove, #remove_attribute, #replace, #root, #search, #set_attribute, #text=, #text?, #to_s, #xpath

Constructor Details

#initialize(target, content, document = nil) ⇒ ProcessingInstruction

Returns a new instance of ProcessingInstruction.



112
113
114
115
116
117
118
119
120
# File 'lib/itonoko/xml/text.rb', line 112

def initialize(target, content, document = nil)
  @node_type  = PROCESSING_INSTRUCTION_NODE
  @node_name  = target
  @document   = document
  @parent     = nil
  @children   = EMPTY_CHILDREN
  @attributes = EMPTY_ATTRS
  @content    = content.to_s
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



110
111
112
# File 'lib/itonoko/xml/text.rb', line 110

def content
  @content
end

Instance Method Details

#_collect_text(_buf) ⇒ Object



126
127
# File 'lib/itonoko/xml/text.rb', line 126

def _collect_text(_buf)
end

#textObject



122
123
124
# File 'lib/itonoko/xml/text.rb', line 122

def text
  ""
end

#to_htmlObject



129
130
131
# File 'lib/itonoko/xml/text.rb', line 129

def to_html
  "<?#{node_name} #{@content}?>"
end

#to_xml(_options = {}) ⇒ Object



133
134
135
# File 'lib/itonoko/xml/text.rb', line 133

def to_xml(_options = {})
  "<?#{node_name} #{@content}?>"
end