| [[library-script-jruby, JRuby Scripting Library]] |
| = JRuby Scripting = |
| |
| [devstatus] |
| -------------- |
| source=libraries/lang-jruby/dev-status.xml |
| -------------- |
| |
| The JRuby Scripting Library allows Mixin methods to be implemented in Ruby and loaded dynamically on first use. |
| |
| include::../../build/docs/buildinfo/artifact.txt[] |
| |
| The JRuby Scripting Library is a Generic mixin that implements interfaces by delegating to Ruby functions using JRuby. Each method in an interface is declared by a Ruby method in a file located in classpath with the name "<interface>.rb", where the interface name includes the package, and has "." replaced with "/". |
| |
| Example: |
| |
| org/qi4j/samples/hello/domain/HelloWorldSpeaker.rb |
| |
| That means that the HelloWorldSpeaker.rb file may be co-located with the class files in the same package. It is currently not supported to place the JRuby implementation of the mixin in a different package than the interface it implements. |
| |
| To use JRuby to implement the Mixin functionality for a given interface, |
| simply declare the +JRubyMixin+ like any other mixin, either in the interface |
| or at assembly time. |
| |
| [snippet,java] |
| ---- |
| source=libraries/lang-jruby/src/test/java/org/qi4j/lang/jruby/HelloSpeaker.java |
| tag=mixin |
| ---- |