Skip to content

ruby_directive

Dewayne VanHoozer edited this page Feb 19, 2024 · 1 revision

The //ruby code directive will execute code within the binding of the AIA::Directives#ruby method - which is very limited. It may not be a very useful directive OR it may be the most powerful directive available. The jury is still out on this one. I think that if you are going to use rRuby to help compose all or part of the prompt text that erb is a better choice.

What could we do with something like this:

//ruby load(path_to_ruby_file); method_name(*)

The result of the eval(code) is expected to be a String. Only Strings will be prepended to the prompt text. ANy other value returned from the eval will be ignored. That's not to say that having a non String returned is not good. The code be be something outside of the evaluation of the current prompt text. For example maybe metrics collection or some other side-effect kind of operation not specific to generating promp text.

Clone this wiki locally