Module: EObjectUtil

Defined in:
lib/emf/eobject_util.rb

Class Method Summary collapse

Class Method Details

.all_contents(root) ⇒ Object



3
4
5
6
7
# File 'lib/emf/eobject_util.rb', line 3

def self.all_contents(root)
	contents = []
	root.getAllContents.each {|e| contents << e}
	contents
end

.only_content_of_eclass(root, eclass) ⇒ Object



9
10
11
12
13
# File 'lib/emf/eobject_util.rb', line 9

def self.only_content_of_eclass(root,eclass)
	selected = all_contents(root).select {|o| o.eClass.isSuperTypeOf eclass}
	raise "One expected, #{selected.count} found" unless selected.count == 1
	selected.first
end