Ruby Macro

Last modified by Admin on 2020/11/23 00:28

ruby-16x16.pngRendering macro to execute Ruby script
Developed by

Thomas Mortagne, XWiki Development Team

Active Installs3
0 Votes
LicenseGNU Lesser General Public License 2.1

Installable with the Extension Manager


This is a shortcut for Script Macro equivalent to {{script language="ruby"}} for executing ruby scripts.


require 'java'
include_class 'java.util.TreeSet'
set =
set.add "foo"
set.add "Bar"
set.add "baz"
set.each do |v|
 puts "value: #{v}"

Parameters definition

See the Script Macro for details.


if $xcontext.getUser() != "XWiki.XWikiGuest" then
 puts "Hello [[#{$xcontext.getUser()}]]!"
 puts "You are not logged in!"

Tested on

This extension has been tested with the following configurations.

Extension VersionXWiki FlavorNotes
6.1XWiki Enterprise 6.1

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager). Note that installing Extensions when being offline is currently not supported and you'd need to use some complex manual method.

You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.

To use ruby macro, you need to install following three libraries inside WEB-INF/lib directory of your XE installation:

Once these libraries are in place, you need to restart your XE installation for the changes to take effect.

Release Notes


  • The extension is now a Contrib extension synchronized on JRuby versions.
  • Upgraded to JRuby


Dependencies for this extension (org.xwiki.contrib:macro-ruby

  • org.xwiki.platform:xwiki-platform-rendering-macro-script 7.4
  • org.jruby:jruby
Tags: ruby script

Get Connected