Class: Arboretum::DocTree::Elements::CommentElement
- Defined in:
- lib/arboretum/doctree.rb
Overview
A comment element of a doctree. CommentElements have no tags nor attributes nor contribute to document content, but are preserved in the tree Ex: <!– This is an example comment –>
Instance Attribute Summary collapse
-
#text ⇒ Object
Returns the value of attribute text.
Attributes inherited from Element
#break_within, #children, #history, #incrementers, #library, #parent, #resetters, #sibling_next, #sibling_prev, #tree_residence
Instance Method Summary collapse
-
#copy ⇒ Object
CommentElement deep copy method.
- #dump_markup(type = :xml) ⇒ Object
-
#initialize(text = '') ⇒ CommentElement
constructor
A new instance of CommentElement.
- #to_s ⇒ Object
Methods inherited from Element
#ancestors, #ancestors_reverse, #append_child, #append_sibling, #can_have_children?, #content, #count, #counter, create, #descendants, #detach, #find, #find_first, #find_first_n, #following_siblings, #graft_first_onto, #graft_last_onto, #graft_onto, #has_children?, #index_in_parent, #insert_child, #inspect, #lib_add, #lib_get, #listing, #matches_rule?, #overwrite!, #preceding_siblings, #preceding_siblings_reverse, #prepend_child, #prepend_sibling, #reset, #set_children!, #set_parent!, #set_sibling_next!, #set_sibling_prev!, stitch!, #text_elements, #text_string, #to_tree, #unwrap_children, #update_tree_residence
Methods included from Loggable
Methods included from Contextualized
Constructor Details
#initialize(text = '') ⇒ CommentElement
Returns a new instance of CommentElement.
1250 1251 1252 1253 1254 1255 |
# File 'lib/arboretum/doctree.rb', line 1250 def initialize(text='') super() # Comment text @text = text # String end |
Instance Attribute Details
#text ⇒ Object
Returns the value of attribute text.
1248 1249 1250 |
# File 'lib/arboretum/doctree.rb', line 1248 def text @text end |
Instance Method Details
#copy ⇒ Object
CommentElement deep copy method
1258 1259 1260 |
# File 'lib/arboretum/doctree.rb', line 1258 def copy CommentElement.new(@text) end |
#dump_markup(type = :xml) ⇒ Object
1262 1263 1264 |
# File 'lib/arboretum/doctree.rb', line 1262 def dump_markup(type=:xml) "<!--#{self.text.gsub('&','&').gsub('<', '<').gsub('>','>')}-->" end |
#to_s ⇒ Object
1266 1267 1268 |
# File 'lib/arboretum/doctree.rb', line 1266 def to_s "<!--#{self.text}-->" end |