Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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
languagetext
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
languagetext
#import ('ruby', 'com.nomagic.reportwizard.tools.script.RubyScriptTool')
$ruby.execute('Functions.rb')
#set ($supplierList = $ruby.eval('supplierList'))
#foreach ($e in $supplierList)
$e.name
#end