Module: RTM::Sugar::Topic::Remove

Defined in:
lib/rtm/sugar/topic/remove.rb

Instance Method Summary collapse

Instance Method Details

#force_removeObject

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.



12
13
14
15
16
17
18
19
20
# File 'lib/rtm/sugar/topic/remove.rb', line 12

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