# $EPIC: ruby_function.txt,v 1.2 2006/08/29 18:22:56 sthalik Exp $
If EPIC was linked with an embedded ruby interpreter, the ruby statement shall be executed by ruby. If EPIC was not linked against ruby, then no action shall take place.
As all ruby statements resolve to a (ruby) object, that (ruby) object shall be converted into a String object, and further into an ircII string and returned. This means the return value shall not be “binary data” (have embedded nuls)
If the ruby statement has an error, the result is undefined, but usually an error message is output to the window and the empty string is returned.
Please remember that all function call arguments are subject to ircII expansion BEFORE the function call occurs. You must ensure that any chars that are special to both ircII and ruby are quoted so ircII doesn't try to honor them.
You can call back to EPIC from ruby. See /ruby for details.
$ruby() is useful for loading ruby scripts and modules, defining simple ruby functions, retrieving variables from within rubyspace and other general maintenance of the ruby environment.
The Object.to_s value of the final value of the ruby expression. This is handled as a C string in ircII, so it cannot contain nuls.
@ruby(rubyvar='$epicvar') Export an epic variable to ruby (as String) @epicvar = ruby(rubyvar) Import a ruby variable to EPIC (uses .to_s) @ruby(1+2*3) Using ruby to do math [more examples are needed]