Page History
References to elements are similar to JavaScript Tool and Groovy Tool. The elements are implicitly inserted into the Ruby context when “eval()” or “execute()” is called. Examples of implicit variables include $Class, $UseCase, $sorter, etc.
For example, File ‘Functions.rb’:
Code Block | ||
---|---|---|
| ||
def supplierList
result = [];
$Dependency.each do |item|
item.supplier.each do |supplier|
result << supplier;
end
end
return result;
end |
Indicated below is the template code.
Code Block | ||
---|---|---|
| ||
#import ('ruby', 'com.nomagic.reportwizard.tools.script.RubyScriptTool')
$ruby.execute('Functions.rb')
#set ($supplierList = $ruby.eval('supplierList'))
#foreach ($e in $supplierList)
$e.name
#end |