Class: Arboretum::DocTree::Elements::CounterElement

Inherits:
TextElement show all
Defined in:
lib/arboretum/doctree.rb

Overview

A TextElement that holds a reference to an incrementer within the tree CounterElements have no tags nor attributes and are only meant to represent document content

Instance Attribute Summary

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 TextElement

#dump_markup, #to_s

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_s, #to_tree, #unwrap_children, #update_tree_residence

Methods included from Loggable

#log, #log_string

Methods included from Contextualized

#swap, #wrap

Constructor Details

#initialize(incrementer) ⇒ CounterElement

Returns a new instance of CounterElement.



1303
1304
1305
1306
# File 'lib/arboretum/doctree.rb', line 1303

def initialize(incrementer)
  super()
  @incrementer = incrementer
end

Instance Method Details

#copyObject

CounterElement deep copy method



1309
1310
1311
# File 'lib/arboretum/doctree.rb', line 1309

def copy
  CounterElement.new(@incrementer)
end

#textObject

The text representation of this element is the value of the referenced incrementere



1314
1315
1316
# File 'lib/arboretum/doctree.rb', line 1314

def text
  @incrementer.value.to_s
end