Sha256: d074e1b3f2dc93397948bcec25ff084e052d653693c8fa799cb9691cf59bc4de

Contents?: true

Size: 833 Bytes

Versions: 1

Compression:

Stored size: 833 Bytes

Contents

# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
# License:   Apache License, Version 2.0

module RTM::Sugar::Topic
  module Remove

  # Forcibly removes this topic from the topic map:
  #
  # * Forcibly removes all associations in which this topic is a player.
  # * Forcibly removes all names and occurrences of this topic.
  # * Removes the type-instance relations this topic occurrs in.
  def force_remove
    # TODO extend this, maybe allow for a removal of any topic no matter how important
    # it may be for the whole topic map
    self.roles_played.to_a.clone.each{ |role| role.parent.force_remove}
    self.names.to_a.clone.each{ |name| name.force_remove}
    self.occurrences.to_a.clone.each{ |occ| occ.force_remove}
    self.types.each{ |type| self.remove_type(type) }
    self.remove
  end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rtm-0.3.1 lib/rtm/sugar/topic/remove.rb