module Arboretum::DocTree::Elements::Contextualized
Public Instance Methods
swap(other)
click to toggle source
Swap locations of this ContextualGroup with another ContextualGroup
# File lib/arboretum/doctree.rb, line 394 def swap(other) puts "Warning: Can't swap with nil" if other.nil? unless other.nil? # Temp other_parent = other.parent other_index = other.index_in_parent other.graft_onto(self.parent, self.index_in_parent) self.graft_onto(other_parent, other_index) end end
wrap(element, index=-1) { |element| ... }
click to toggle source
Wrap this ContextualGroup in an Element
, with the wrapping Element
taking this ContextualGroup's original place in the tree If the wrapping Element
already exitst, then this ContextualGroup is pushed to the given index in the other's children (but also idk why would you need to do that?)
# File lib/arboretum/doctree.rb, line 408 def wrap(element, index=-1) element = Element.create(element) if element.is_a?(Hash) element.graft_onto(self.parent, self.index_in_parent) self.graft_onto(element, index) yield element if block_given? element end