lib/rgen/model_dumper.rb in rgen-0.3.0 vs lib/rgen/model_dumper.rb in rgen-0.4.0
- old
+ new
@@ -4,16 +4,16 @@
def dump(obj=nil)
obj ||= self
if obj.is_a?(Array)
obj.collect {|o| dump(o)}.join("\n\n")
- elsif obj.class.respond_to?(:one_attributes) && obj.class.respond_to?(:many_attributes)
+ elsif obj.class.respond_to?(:ecore)
([obj.to_s] +
- obj.class.one_attributes.collect { |a|
- " #{a} => #{obj.getGeneric(a)}"
+ obj.class.ecore.eAllStructuralFeatures.select{|f| !f.many}.collect { |a|
+ " #{a} => #{obj.getGeneric(a.name)}"
} +
- obj.class.many_attributes.collect { |a|
- " #{a} => [ #{obj.getGeneric(a).join(', ')} ]"
+ obj.class.ecore.eAllStructuralFeatures.select{|f| f.many}.collect { |a|
+ " #{a} => [ #{obj.getGeneric(a.name).join(', ')} ]"
}).join("\n")
else
obj.to_s
end
end
\ No newline at end of file