Module: RTM::Sugar::TopicMap::Remove

Defined in:
rtm/lib/rtm/sugar/topic_map/remove.rb,
rtm/spec/rtm/sugar/topic_map/remove_spec.rb

Instance Method Summary

Instance Method Details

- (Object) clear

Removes all variants, names, occurrences, roles, asssociations and topics (esp. reifier) from this topic map.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'rtm/lib/rtm/sugar/topic_map/remove.rb', line 9

def clear
  set_reifier(nil)
    
  variants.to_a.each do |v|
    v.set_reifier(nil)
    v.remove
  end
           
  names.to_a.each do |n|
    n.set_reifier(nil)
    n.remove
  end
    
  occurrences.to_a.each do |o|
    o.set_reifier(nil)
    o.remove
  end
       
  roles.to_a.each do |r|
    r.set_reifier(nil)
    r.remove
  end
         
  associations.to_a.each do |a|
    a.set_reifier(nil)
    a.remove
  end

  types.to_a.each do |type|
    type.instances.to_a.each do |instance|
      instance.remove_type(type)
    end
  end

  topics.to_a.each do |t|
    t.remove
  end

end