module Infoboxer::Tree::Mergeable

@private

Public Instance Methods

can_merge?(other) click to toggle source
# File lib/infoboxer/tree/paragraphs.rb, line 34
def can_merge?(other)
  !closed? && self.class == other.class
end
merge!(other) click to toggle source
# File lib/infoboxer/tree/paragraphs.rb, line 38
def merge!(other)
  if other.is_a?(EmptyParagraph)
    @closed = true
  else
    [splitter, *other.children].each do |c|
      c.parent = self
      @children << c
    end
    @closed = other.closed?
  end
end