Class: Arboretum::DocTree::Elements::PIElement

Inherits:
Element
  • Object
show all
Defined in:
lib/arboretum/doctree.rb

Overview

An XML Processing Instruction element in the doctree PIElements have no tags nor attributes nor contribute to document content, but are preserved in the tree Ex: <?…?> represents a processing instruction i.e. <?PITarget PIContent?>

Instance Attribute Summary collapse

Attributes inherited from Element

#break_within, #children, #history, #incrementers, #library, #parent, #resetters, #sibling_next, #sibling_prev, #tree_residence

Instance Method Summary collapse

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

#log, #log_string

Methods included from Contextualized

#swap, #wrap

Constructor Details

#initialize(text = '') ⇒ PIElement

Returns a new instance of PIElement.



1278
1279
1280
1281
1282
1283
# File 'lib/arboretum/doctree.rb', line 1278

def initialize(text='')
  super()
  
  # Element text
  @text = text  # String
end

Instance Attribute Details

#textObject

Returns the value of attribute text.



1276
1277
1278
# File 'lib/arboretum/doctree.rb', line 1276

def text
  @text
end

Instance Method Details

#copyObject

PIElement deep copy method



1286
1287
1288
# File 'lib/arboretum/doctree.rb', line 1286

def copy
  PIElement.new(@text)
end

#dump_markup(type = :xml) ⇒ Object



1290
1291
1292
# File 'lib/arboretum/doctree.rb', line 1290

def dump_markup(type=:xml)
  "<?#{self.text.gsub('&','&amp;').gsub('<', '&lt;').gsub('>','&gt;')}?>"
end

#to_sObject



1294
1295
1296
# File 'lib/arboretum/doctree.rb', line 1294

def to_s
  "<?#{self.text}?>"
end