Class: Itonoko::XML::Comment
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
-
#content ⇒ Object
Returns the value of attribute content.
Attributes inherited from Node
#children, #document, #node_type, #parent
Instance Method Summary collapse
- #_collect_text(_buf) ⇒ Object
-
#initialize(content, document = nil) ⇒ Comment
constructor
A new instance of Comment.
- #node_name ⇒ Object
- #text ⇒ Object
- #to_html ⇒ Object
- #to_xml(_options = {}) ⇒ Object
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(content, document = nil) ⇒ Comment
Returns a new instance of Comment.
78 79 80 81 82 83 84 85 86 |
# File 'lib/itonoko/xml/text.rb', line 78 def initialize(content, document = nil) @node_type = COMMENT_NODE @node_name = "#comment" @document = document @parent = nil @children = EMPTY_CHILDREN @attributes = EMPTY_ATTRS @content = content.to_s end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
76 77 78 |
# File 'lib/itonoko/xml/text.rb', line 76 def content @content end |
Instance Method Details
#_collect_text(_buf) ⇒ Object
92 93 94 |
# File 'lib/itonoko/xml/text.rb', line 92 def _collect_text(_buf) # Comments don't contribute to text content. end |
#node_name ⇒ Object
104 105 106 |
# File 'lib/itonoko/xml/text.rb', line 104 def node_name "#comment" end |
#text ⇒ Object
88 89 90 |
# File 'lib/itonoko/xml/text.rb', line 88 def text "" end |
#to_html ⇒ Object
96 97 98 |
# File 'lib/itonoko/xml/text.rb', line 96 def to_html "<!--#{@content}-->" end |
#to_xml(_options = {}) ⇒ Object
100 101 102 |
# File 'lib/itonoko/xml/text.rb', line 100 def to_xml( = {}) "<!--#{@content}-->" end |