I got something to work at least. This should give you an idea of how I
did it:

    def remove!
      case @node.node_type
      when :text
        @node.value = ''
      else
        @node.parent.send("delete_#{@node.node_type}", @node )
      end
    end

    def empty!
      each { |n| n.remove! }
    end

T.