# File lib/rgen/serializer/xml_serializer.rb, line 32 def endTag(tag) @indent -= 1 unless handleLastStartTag(true, true) output " "*@indent*INDENT_SPACE unless @textContent output "</#{tag}>\n" end @textContent = false end
# File lib/rgen/serializer/xml_serializer.rb, line 16 def serialize(rootElement) raise "Abstract class, overwrite method in subclass!" end
# File lib/rgen/serializer/xml_serializer.rb, line 20 def startTag(tag, attributes={}) @textContent = false handleLastStartTag(false, true) if attributes.is_a?(Hash) attrString = attributes.keys.collect{|k| "#{k}=\"#{attributes[k]}\""}.join(" ") else attrString = attributes.collect{|pair| "#{pair[0]}=\"#{pair[1]}\""}.join(" ") end @lastStartTag = " "*@indent*INDENT_SPACE + "<#{tag} "+attrString @indent += 1 end
# File lib/rgen/serializer/xml_serializer.rb, line 74 def containmentReferences(element) @containmentReferences ||= {} @containmentReferences[element.class] ||= eAllReferences(element).select{|r| r.containment} end
# File lib/rgen/serializer/xml_serializer.rb, line 54 def eAllAttributes(element) @eAllAttributes ||= {} @eAllAttributes[element.class] ||= element.class.ecore.eAllAttributes end
# File lib/rgen/serializer/xml_serializer.rb, line 49 def eAllReferences(element) @eAllReferences ||= {} @eAllReferences[element.class] ||= element.class.ecore.eAllReferences end
# File lib/rgen/serializer/xml_serializer.rb, line 59 def eAllStructuralFeatures(element) @eAllStructuralFeatures ||= {} @eAllStructuralFeatures[element.class] ||= element.class.ecore.eAllStructuralFeatures end
# File lib/rgen/serializer/xml_serializer.rb, line 64 def eachReferencedElement(element, refs, &block) refs.each do |r| targetElements = element.getGeneric(r.name) targetElements = [targetElements] unless targetElements.is_a?(Array) targetElements.each do |te| yield(r,te) end end end
Generated with the Darkfish Rdoc Generator 2.