Sha256: 1810d8ce82c6a10bf004de1bd8015d11a11bfc3dcf5dbee1125583bb6b1940c0

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

<% define 'Annotations', :for => EPackage do %>
	<% for a in eAnnotations %>
		annotation <% expand 'AnnotationArgs', :for => a %>
	<% end %>
<% end %>

<% define 'Annotations', :for => EClass do %>
	<% for a in eAnnotations %>
		annotation <% expand 'AnnotationArgs', :for => a %>
	<% end %>
<% end %>

<% define 'Annotations', :for => EStructuralFeature do %>
	<% oppositeAnnotations = (this.respond_to?(:eOpposite) && eOpposite && eOpposite.eAnnotations) || [] %>
	<% if eAnnotations.size > 0 || oppositeAnnotations.size > 0 %>
		do<%iinc%>
			<% for a in eAnnotations %>
				annotation <% expand 'AnnotationArgs', :for => a %>
			<% end %>
			<% for a in oppositeAnnotations %>
				opposite_annotation <% expand 'AnnotationArgs', :for => a %>
			<% end %><%idec%>
		end<%nows%>
	<% end %>
<% end %>

<% define 'AnnotationArgs', :for => EAnnotation do %>
	<% if source.nil? %>
		<% expand 'Details' %>
	<% else %>
		:source => "<%= source.to_s %>", :details => {<% expand 'Details' %>}<%nows%>
	<% end %>
<% end %>

<% define 'Details', :for => EAnnotation do %>
	<%= details.sort{|a,b| a.key<=>b.key}.collect{ |d| "\'" + d.key + "\' => \'"+ d.value.gsub('\'','\\\'').to_s + "\'"}.join(', ') %><%nows%>
<% end %>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rgen-0.4.0 lib/mmgen/templates/annotations.tpl