Class: Itonoko::XML::Comment

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::ESCAPE_ATTR, Node::ESCAPE_TEXT, Node::PROCESSING_INSTRUCTION_NODE, Node::TEXT_NODE

Instance Attribute Summary collapse

Attributes inherited from Node

#children, #document, #node_type, #parent

Instance Method Summary collapse

Methods inherited from Node

#==, #[], #[]=, #add_child, #add_next_sibling, #add_previous_sibling, #ancestors, #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.



59
60
61
62
# File 'lib/itonoko/xml/text.rb', line 59

def initialize(content, document = nil)
  super(COMMENT_NODE, "#comment", document)
  @content = content.to_s
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



57
58
59
# File 'lib/itonoko/xml/text.rb', line 57

def content
  @content
end

Instance Method Details

#node_nameObject



76
77
78
# File 'lib/itonoko/xml/text.rb', line 76

def node_name
  "#comment"
end

#textObject



64
65
66
# File 'lib/itonoko/xml/text.rb', line 64

def text
  ""
end

#to_htmlObject



68
69
70
# File 'lib/itonoko/xml/text.rb', line 68

def to_html
  "<!--#{@content}-->"
end

#to_xml(_options = {}) ⇒ Object



72
73
74
# File 'lib/itonoko/xml/text.rb', line 72

def to_xml(_options = {})
  "<!--#{@content}-->"
end