Site Tools


ruby_function

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

ruby_function [2006/08/29 20:18] (current)
Line 1: Line 1:
 +# $EPIC: ruby_function.txt,​v 1.2 2006/08/29 18:22:56 sthalik Exp $
 +======Synopsis:​======
 +$ruby(//​ruby statement//​)
 +
 +======Purpose:​======
 +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 statement//​s 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 command|ruby]] for details.
 +
 +======Practical:​======
 +$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.
 +
 +======Returns:​======
 +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.
 +
 +======Examples:​======
 +<​file>​
 +@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]
 +</​file>​
 +
 +======History:​======
 +
  
ruby_function.txt ยท Last modified: 2006/08/29 20:18 (external edit)