Class: Itonoko::XML::CDATA
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
-
#content ⇒ Object
Returns the value of attribute content.
Attributes inherited from Node
#children, #document, #node_type, #parent
Instance Method Summary collapse
-
#initialize(content, document = nil) ⇒ CDATA
constructor
A new instance of CDATA.
- #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, #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) ⇒ CDATA
Returns a new instance of CDATA.
34 35 36 37 |
# File 'lib/itonoko/xml/text.rb', line 34 def initialize(content, document = nil) super(CDATA_SECTION_NODE, "#cdata-section", document) @content = content.to_s end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
32 33 34 |
# File 'lib/itonoko/xml/text.rb', line 32 def content @content end |
Instance Method Details
#node_name ⇒ Object
51 52 53 |
# File 'lib/itonoko/xml/text.rb', line 51 def node_name "#cdata-section" end |
#text ⇒ Object
39 40 41 |
# File 'lib/itonoko/xml/text.rb', line 39 def text @content end |
#to_html ⇒ Object
43 44 45 |
# File 'lib/itonoko/xml/text.rb', line 43 def to_html @content end |
#to_xml(_options = {}) ⇒ Object
47 48 49 |
# File 'lib/itonoko/xml/text.rb', line 47 def to_xml( = {}) "<![CDATA[#{@content}]]>" end |